I am trying to set up an SPI communication to a chip using the BOARD_SOFT_SPI_SS2 (SPI only p53 chip select. MISO = p50, MOSI = p51 SCK = p52).
I have no success to get a correct signal for the MOSI pin 50. It looks like is staying in tri-state like it was not correctly set as an output. I have very tiny pukse (about 0.5V) at a level of 5V. The pulse are not going to zero
I have tested the pin as an ouptut with a simple program and it is ok.
When I do a SPI transfer, I use the instruction like this : SPI.transfer(BOARD_SOFT_SPI_SS2,reg)
Any hint ?
what am I missing ? Should I define the role of the SPI pins somewhere ?
Is there a complete exemple the BOARD_SOFT_SPI_SS2 somewhere because I did not find anything in the examples.
Your test program works fine on our rig with BOARD_SPI_SS2. However this will only work on boards of revision 4269.03.06210_B1 or later. The BOARD_SOFT_SPI_SS2 also works and this is OK for any board revision. The _cs must be the same as the SPI channel chosen. Here is your example:
I have define _cs as pin 9 on purpose in order to interface with my sensors. So, let’s keep it like that because I recombine it with pin53 later in my electronics.
With this said, when I choose BOARD_SPI_SS2, I see that pin 53 (cs) is correctly activated in my simple example.
The pin 53 is de/activated by the instructions "endTransaction" and "beginTransaction". If I remove these isntructions, the pin 53 is no more activated.
Indeed if I define _cs as SPI_channel it works also but I think it is a double activation and it works also.
Then with the same simple script, if I switch from BOARD_SPI_SS2 to BOARD_SOFT_SPI_SS2, the SPI pins are going crazy, specialy the clock and cs. If I have some time, I will push some screenshots of my scope here.
C) Nothing clear in the documentation about SPI speed. How is it related to the board clock ? For now I can just see that indeed changing the speed change the SPI clock.
The board version is marked on the underside under the double row connector. It be something like "469.03.06210_B1".
The BOARD_SPI_SS2 channel will control the chip select (p53) automatically if you use the "SPI_CONTINUE mode. If you only use SPI_LAST, it will not control the chip select and you can use both 53 and 9 as separate chip selects. The Baudrate is around 4MHz in soft SPI mode.
The software SPI BOARD_SOFT_SPI_SS2 can only work with one chip select i.e. p53. This could be changed if it is a problem.