This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SPI with chip select using GPIO in SDK V11.0 not working

Hi,

I am trying to use SPI to get data from a sensor. In nRF 5 SDK V11, I got it to work by setting the SS pin in the config struct of the initialization function.

image description

Now, instead of declaring the chip select in the config structure, I want to use a GPIO pin to achieve the same. I think I am configuring everything correctly but I am not reading the right values. I am getting some garbage values. Here's my main file

image description

SPI initialization function now looks like this

image description

The bmaInit() function involves writing data through SPI and so I pulled it low and back high.

Should be pretty straightforward but I can't seem to get it to work. I read different garbage values in every loop. Am I missing something? I feel there's a problem with timing or with reading the buffers. Appreciate any help! Thanks.

Parents
  • Hi Ole,

    I am using 52 dk. I tried both blocking and non-blocking modes and neither of them worked. Is there a flag to check if transaction is complete? Even otherwise I tried having a 10-20 ms delay before pulling the line high which should be enough time for data transfer. I am trying to get a logic analyzer but that's going to take some time and I needed to get this done soon.

    Have you made it work before? If yes, do you have a code that I could try?

Reply
  • Hi Ole,

    I am using 52 dk. I tried both blocking and non-blocking modes and neither of them worked. Is there a flag to check if transaction is complete? Even otherwise I tried having a 10-20 ms delay before pulling the line high which should be enough time for data transfer. I am trying to get a logic analyzer but that's going to take some time and I needed to get this done soon.

    Have you made it work before? If yes, do you have a code that I could try?

Children
No Data
Related