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

Very simple SPI Code

I am really struggling to get my ADXL345 SPI code working. Everything works fine on a LPC1768 and all outputs are fine on the nRF51822 Eval board, but there is no activity on the MISO pin. Is there any reason why I could not implement a simple method whereby I write to the TXD register and monitor the Events Ready pin before reading the received data?

Parents
  • Hi Julian

    Have you looked at the SPI examples in the nRF51 SDK?

    Update 17.12.2014 I do not have something really simple SPI set up, but I think it should be possible to do it in these steps:

    • Initialize the SPI master, similarly as is done in the spi_master_init function in the spi_master_example.
    • Define the SPI IRQ handler and initialize it.
    • Write a byte to TXD

    Anyway I think the easiest way to move forward is to use the SPI driver in perhaps a more simple way than the SPI loopback example does:

    • Define an event handler in your main function
    • create RX and TX buffers and initialize them with data
    • Initialize the SPI_0 master by calling spi_master_init with the name of the event handler you defined
    • Call spi_send_recv function to send and receive data on the SPI
    • Monitor your configured SPI pins with a logical analyzer or oscilloscope.
    • First step is to see the clock signal on CLK pin and your TX data clocked out on MOSI pin.
    • Next step would be to loop that data back into the MISO pin and check the RX buffer
Reply
  • Hi Julian

    Have you looked at the SPI examples in the nRF51 SDK?

    Update 17.12.2014 I do not have something really simple SPI set up, but I think it should be possible to do it in these steps:

    • Initialize the SPI master, similarly as is done in the spi_master_init function in the spi_master_example.
    • Define the SPI IRQ handler and initialize it.
    • Write a byte to TXD

    Anyway I think the easiest way to move forward is to use the SPI driver in perhaps a more simple way than the SPI loopback example does:

    • Define an event handler in your main function
    • create RX and TX buffers and initialize them with data
    • Initialize the SPI_0 master by calling spi_master_init with the name of the event handler you defined
    • Call spi_send_recv function to send and receive data on the SPI
    • Monitor your configured SPI pins with a logical analyzer or oscilloscope.
    • First step is to see the clock signal on CLK pin and your TX data clocked out on MOSI pin.
    • Next step would be to loop that data back into the MISO pin and check the RX buffer
Children
No Data
Related