Using an nRF52832 with SDK15.2 can I have multiple SPI devices;
one with DMA and one without DMA?
And can one instance be of legacy type (nrf_drv_spi) and the other be of new nrfx type?
Using an nRF52832 with SDK15.2 can I have multiple SPI devices;
one with DMA and one without DMA?
And can one instance be of legacy type (nrf_drv_spi) and the other be of new nrfx type?
In SDK v15.2.0 the nrf_drv_spi API wraps the new nrfx_spim.c and nrfx_spi.c drivers, where nrfx_spim.c are used if SPIx_USE_EASY_DMA is set to 1 in sdk_config.h and nrfx_spi.c is used if it is set to 0.
So if you want to use SPIM0 and SPI1, i.e. one SPI interface with EasyDMA and one without, then you need to define the following in sdk_config.h
// <e> SPI0_ENABLED - Enable SPI0 instance
//==========================================================
#ifndef SPI0_ENABLED
#define SPI0_ENABLED 1
#endif
// <q> SPI0_USE_EASY_DMA - Use EasyDMA
#ifndef SPI0_USE_EASY_DMA
#define SPI0_USE_EASY_DMA 1
#endif
// </e>
// <e> SPI1_ENABLED - Enable SPI1 instance
//==========================================================
#ifndef SPI1_ENABLED
#define SPI1_ENABLED 1
#endif
// <q> SPI1_USE_EASY_DMA - Use EasyDMA
#ifndef SPI1_USE_EASY_DMA
#define SPI1_USE_EASY_DMA 0
#endif
We do generally recommend using the SPIM0-2 interface over the deprecated SPI0-2 interfaces in new designs, see Instantiation in the nRF52832 Product Specification.
Best regards
Bjørn
One of our concerns on the SPI/SPIM operation is that we have a need for a single byte transfer to read data from a slave device. The slave expects a zero byte input (which it ignores) on this read cycle and it sends back an 8-bit data item. When we code our SPIm_trfer to a count of '1' for each of the tx & rx buffers, we sometimes see 2-bytes transferred on the MOSI/MISO (16 clks) and sometimes we see THREE bytes in the transfer.
How do we accomplish just a single byte transfer in a SPI transaction. (For now, this is an EasyDMA transfer. We have also checked the box for Anomally_109 in the SPI portion of the SDK_config.h file)
Thanks,
Wayne
Hi Wayne,
this is a known issue described in [58] SPIM: An additional byte is clocked out when RXD.MAXCNT = 1. Errata 58 also describes a workaround for this issue.
Best regards
Bjørn
Hi Bjorn-this helped with part of the issue. NOW we can see that what we really need is to be able to insert some amount of delay between bytes that we send (and hence) bytes that we receive.
Is there away with the 52832 that we can insert a delay between bytes? I don't think it has to be a large delay, maybe 2-3 microSecs.
Thanks,
Wayne
Hi Wayne, do you mean a delay between the TX and RX or a delay between each byte sent from the nRF52832? The timing between each byte is determined by the SPI hardware, i.e. Serial Peripheral Interface Master (SPIM) timing specifications. I do not think that you can alter this.
Why do you need to add a delay?
Hi Wayne, do you mean a delay between the TX and RX or a delay between each byte sent from the nRF52832? The timing between each byte is determined by the SPI hardware, i.e. Serial Peripheral Interface Master (SPIM) timing specifications. I do not think that you can alter this.
Why do you need to add a delay?