This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SPI Slave receive buffer gets garbage values

Hello

I am interfacing between a SPI Master (microcontroller) with a SPI Slave (nRF52832 based chip) and I get the following output on both ends. The transmission seems to be occurring but the content in the receive buffer in the spi slave program is FF

The reason I need SPI to work is so I can use slave to send data wirelessly through BLE. 

I am sending "abc" from Master but FF is being received by slave

I am sending "abcd" from slave but yyyy is being received by master 

Please help me understand where I am going wrong. - using IAR workbench and there are no issues in hardware connections and definitions/ initializations.  

This is Slave output - all FF values 

This is Master output 

Thank you,

tp2k20

  • In case the figure above is unclear, please see the attached figure. 

  • Hello,

    I think the first thing you should check is that you are using the correct SPI mode.

    NRF_DRV_SPIS_DEFAULT_CONFIG sets the spis_config.mode = NRF_SPIS_MODE_0. I don't know what mode your SPIM uses, but the quickest way to check is to try all the modes:
    NRF_SPIS_MODE_0
    NRF_SPIS_MODE_1
    NRF_SPIS_MODE_2
    NRF_SPIS_MODE_3

    Just set:

    spis_config.mode = NRF_SPIS_MODE_1

    after you configure the pins to test mode 1.

    If that doesn't do the trick, then check that you have wired the connection correctly. Are you sure that you set MOSI -> MOSI and MISO -> MISO (and not the opposite)?

    Another thing to check is the pull of the pins. What way does your SPIM drive the pin? Check:

    spis_config.csn_pullup   = NRFX_SPIS_DEFAULT_CSN_PULLUP,

    My hunch is on the mode, but let me know if this doesn't work.

    By the way, what is the frequency that your SPIM use?

    Best regards,

    Edvin

Related