cancel
Showing results for 
Search instead for 
Did you mean: 

BLUENRG2 SPI slave mode issue (getting only the first byte of a frame)

SRibo
Associate II

Hello,

I'm working on a BlueNRG2 device.

I'm getting some trouble using the SPI in slave mode.

If I configure the SPI with SPI_CPOL_Low and SPI_CPHA_2Edge configuration, I can receive from the master all bytes.

If I configure the SPI with SPI_CPOL_Low and SPI_CPHA_1Edge I can receive from the master only the first byte after the CS falling edge (all the others bytes are lost). If the master raise and lower the CS and then start a new frame transmission, I receive only the first byte again.

I tryed also the SlavePolling project (in the "BlueNRG-1_2 DK 3.1.0" package) with a little modification in the processCommand function to collect all received bytes in a global array), but I get the same result (I can collect all bytes for the SPI_CPHA_2Edge configuration, I loose all bytes after the first for the SPI_CPHA_1Edge configuration).

Am I missing something? Or there is a limitation about the SPI edge configuration in slave mode?

Thankyou.

Best regards.

Saverio.

4 REPLIES 4
Winfred LU
ST Employee

Hi Saverio,

Please note that for CPHA first edge, CS line must be pulsed HIGH between each data word transfer.

This is described in BlueNRG-2 datasheet, Table 51. SPI clock phase and clock polarity:

https://www.st.com/resource/en/datasheet/bluenrg-2.pdf

Best Regards,

Winfred

SRibo
Associate II

Hi Winfred,

Thankyou, you are right, I didn't noted that line in the table.

But is this a BlueNRG2 limitation? Because I worked in the past also on different kind of microcontrollers (microchip) but I don't remember this difference between first edge and second edge mode.

Thankyou.

Regards.

Saverio.

Hi Saverio,

Yes, you may regard it as a limitation of BlueNRG-2, when it is a SPI slave with CHPA first edge.

In the perspective of SPI protocol, CS pin does not have to toggle between each data byte, which is the same for CPHA first edge and second edge mode.

Best Regards,

Winfred

SRibo
Associate II

Hi Winfred.

Thankyou for your clarification.

Best regards.

Saverio.