dumbo
New Member
Posts: 10
|
Post by dumbo on Sept 7, 2018 6:36:45 GMT
user background: IDE: Arduino V1.8.6 ShieldBuddy Board (by Hitex) : S/N 4269.030626 ShieldBuddy TC275 User Manual "Preliminary" (by Hitex): 4269.40100,V1.8,2015-05
Hi all
The default SPI channel 0 on the board is SCK pin 62 (or P201.3) MISO pin 61 (or P201.1) MOSI pin 63 (or 201.4) SS pin 10
My intention or TARGET is to use SPI channel 1 : SCK Pin 13 MISO Pin 12 MOSI Pin 11 SS Pin 10 (same)
i could successfully use channel 0 for SPI Communication. But now would like to use Channel 1 instead. Could someone advice on how to tell inside Arduino IDE that i wish to reassign the SPI communication to channel 1, same slave select P10?
The HITEX User Manual did mentioned about this in session 2.10.1 saying to use it with:
Spi.begin(BOARD_SPI_SS0_S1) ; //Use SPI1 with slave select on p10
i get no target outcome. Does the above "Spi.begin(xxx)" need to be all be CAPs like "SPI.begin(xxx)" Any other special library i need to include inside IDE instead of the already included <SPI.h>?
Hope someone could drop some hint, thank you.
|
|
|
Post by Admin on Sept 7, 2018 6:59:07 GMT
Hi,
If you have:
Spi.begin(BOARD_SPI_SS0_S1) ; //Use SPI1 with slave select on p10
then you need to use:
Spi.transfer(BOARD_SPI_SS0_S1, data);
|
|
dumbo
New Member
Posts: 10
|
Post by dumbo on Sept 7, 2018 9:02:03 GMT
Thank you
With your kind suggestion above on SPI.transfer, i could see the SCK in SPI Channel 1 now but not the full 32 bit data.Meaning the MOSI is not sending anything out...
For the original SPI CH 0 (default), this is not the problem...
Any suggestion to bring the 32 bit data at MOSI for SPI CH1? (see attachment scope-shots)
|
|
|
Post by Admin on Sept 7, 2018 10:57:09 GMT
If the SCLK is working then it is very odd that the MOSI is inactive. The SPI driver only sends 8 bits of data as this is the Arduino standard!
|
|
dumbo
New Member
Posts: 10
|
Post by dumbo on Sept 10, 2018 0:23:23 GMT
yes you a right 8bit but alone is successful. Lets' put 32bittransfer one side and focus on 2x 8bitin one single Slave select.
I tried using the instructions below inside the sketch:
SPI.transfer(BOARD_SPI_SS0_S1,valve,SPI_CONTINUE); SPI.transfer(BOARD_SPI_SS0_S1,value,SPI_CONTINUE);
The outcome is in attachment 3 SPI_CH1_2seperate_SS.How could we get all 2x8bit into 1 single Slave select? It is possible? Does the syntax SPI_CONTINUE or SPI.transfer(buffer,size) recommended for Arduino Due/Uno also works with CH1 SPI communication?
|
|
dumbo
New Member
Posts: 10
|
Post by dumbo on Sept 24, 2018 2:56:54 GMT
For SPI 8bit frame transfer Since to do a 8 bit SPI exchange, is recommended with this command Spi.transfer(BOARD_SPI_SS0_S1, data); For SPI 16bit transfer: So for 16bit , using SPI.transfer(buffer,size), is it applying SPI.transfer(BOARD_SPI_SS0_S1, data,buffer,size);? www.arduino.cc/en/Reference/SPITransfer
|
|
dumbo
New Member
Posts: 10
|
Post by dumbo on Sept 24, 2018 4:04:30 GMT
ok just figured out below works:)
void setup() { SPI.begin (BOARD_SPI_SS0_S1);//shieldbuddy SPI CH1 SPI.beginTransaction(BOARD_SPI_SS0_S1,SPISettings(10000000, MSBFIRST, SPI_MODE0)); }
void loop() { SPI.transfer(BOARD_SPI_SS0_S1,&value,4); //SPI CH1 MOSI in action for (int i=0;i<4;i++) {response=valuecl;} //retrieve MISO data from "reused" buffer called value }
Thank you.
|
|
|
Post by Admin on Sept 24, 2018 14:50:51 GMT
Great!
|
|