Add initialization sequence to SPIM interface

I am developing for NRF52840 on a custom board (SDK 15.0, Segger), and working on integration with a HTRC110 RFID HITAG reader chip. This chip supports 3-wire SPI, for which I'm using the NRFX_SPIM driver. I am able to get the driver to transmit bytes as expected, as shown below.

However, the chip specifies that SCLK and DIN (MOSI) must go high before beginning to send a byte on DIN.

Once I've initialized the SPIM driver via nrfx_spim_init, I am unable to manually drive the SCLK and MOSI pins to perform that initialization. I have tried calling nrfx_spim_uninit, driving the pins high, then re-initializing the SPIM driver, but this results in a delay of 15us between the falling edge and the beginning of the driver's transmit operation.

Is there any other way of configuring the driver to perform this initialization? Should I be using a different driver rather than NRFX_SPIM?

Thanks

Parents Reply Children
  • kfxkaplan said:
    This did the trick, thank you so much for your help!

    I'm glad to hear it worked out, let me know if you do find any issues. 

    One scenario you might want to be aware of is if an ISR executes between sending the start-condition and triggering the SPIM start task, then you will likely experience similar issues as before. You should therefore make your application tolerant to this SPI fault.

Related