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

Basic SPI setup

Hello,

I am using a nrf52 DK in an educational context.

For this reason, I am not using the SDK, but implement basic features on a lower level.

I used the implementation in nrfx_spi.c from SDK17.0.2_d674dde as reference.

Before I provide a minimal code example and such, I would like to verify if my approach should in theory work.

Initialization:

1. Disable SPI

2. Configure SCK, MOSI, MISO pins

3. Set cpol,cpha, order bits in config-register

4. Set frequency register

5. Set miso, mosi and sck register to specify used pins

6. Enable SPI

Next, I want to measure, if either the clock, or the Mosi pin behave correctly, therefore I use a basic send_byte function:

send_byte:

1. Read last byte from RXD-register

2. Clear the spi-event-register (This should already be cleared by the read instruction?)

3. Write a byte in the TXD-register

If I now use the send_byte function in a loop without delays, should I be able to measure a signal on either the MOSI or SCK pin?

The only behaviour I am currently getting, is that the SCK pin goes high after I am using the send_byte function for the first time.

The pin does not change its level afterwards.

Would greatly appreciate some help!

Parents Reply Children
No Data
Related