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

Simple SPI

Hello,

I am using nrf9160 and want to test the just simple SPI function. The code that I found from github(https://github.com/Rallare/fw-nrfconnect-nrf/tree/nrf9160_samples/samples/nrf9160/spi c) is old and gives me too many errors. Are there any simple SPI code that I can try in my nrf9160 board in order to test whether I can send a simple data via SPI. I also found spi_flash_at45 however I don't have any device from at45 family to test it so another simple example would be so helpful for me. 

Thank you

Parents Reply Children
  • Hi Hakan,

    The pins are changed no problem in that part rigth now but still I can't see the rigth signal in the logic analyzer. I adjusted edge triggering with rising edge( also tried with falling and all other triggering options) I see that clk signal seems always high. Not 0-1-0-1 its always one.I played with sampling frequency but it also didn't change the result. I tested the logic analyzer with different chip and I saw 1-0-1-0 clk signal so logic analyzer is working fine. I didn't change the code that you sent me and it is doing loopback so no problem in spi functionality. Then what should I do in this case? I just want to see the clk signal and mosi in this case I thought that just attaching the logic analyzer to those output pins was sufficient to see the outputs am I missing something in this point?

    Thank you

  • Hi, I couldn't get an answer for my last reply do you have any idea of what can I also try?

    Thank for the help so much

  • Hi,

     

    On the UART terminal (serial terminal), are you getting the expected output when connecting MISO to MOSI using a patch wire?

    ie: 

    TX sent: X

    RX recv: X

     

    BR,

    Håkon

  • Hi,

    Yes when I connect miso to mosi with a wire I receive the same value. I also changed the gpio pins for clk and miso it also works fine when I change them I can still see the outputs on lte link monitor. The only problem is I cant even see the clk ouput 1-0-1-0 on logic analyzer, I also cant see mosi. The clk pin always gives 1 in logic analyzer but it should be 0-1-0-1. I changed the sampling rate, frequenct however still result is same. I didn't understand what I am missing. Should I have to make additional changes in the code or should I need to do some adjustments in the logic analyzer. But in logic analyzer when I just send 1-0-1-0 from gpio pins(different from spi pins) I was be able to see the output clearly without doing any modification

    Thank you

  • Hi,

     

    verulia said:
    Yes when I connect miso to mosi with a wire I receive the same value. I also changed the gpio pins for clk and miso it also works fine when I change them I can still see the outputs on lte link monitor. The only problem is I cant even see the clk ouput 1-0-1-0 on logic analyzer, I also cant see mosi.

    If you are not able to view the data on your logic analyzer when looking at MISO, but the serial output shows that it sends for instance 10 and receives 10 when you connect MISO to MOSI, then the pin itself does toggle.

    It is then a problem with your logic analyzer PC setup.

     

    Kind regards,

    Håkon

Related