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

Confusion with List in EasyDMA

Hi,

The samples for using list are BUFFER = 4, but it does not specify is that is the only size that works, and what value do you place on NRF_SPIM0->TXD.LIST

In my case I need a buffer size of 8, and 46 samples. I implemented the following, among other code, which does not seem to have any effect. Am I missing something?

#define BUFFER 8

typedef struct ArrayList {
	uint8_t buffer[BUFFER];
} ArrayList_type;

ArrayList_type MyArrayList[46];
ArrayList_type MyReceiveList[46];

NRF_SPIM0->TXD.PTR    = (uint32_t)MyArrayList;
NRF_SPIM0->TXD.MAXCNT = 46;

NRF_SPIM0->RXD.PTR    = (uint32_t)MyReceiveList;
NRF_SPIM0->RXD.MAXCNT = 46;

nrf_spim_event_clear(NRF_SPIM0, NRF_SPIM_EVENT_ENDTX);
NRF_SPIM0->TXD.LIST = 8;  //I tried as per documentation to only place a 1 here.
NRF_SPIM0->RXD.LIST = 8;
nrf_spim_task_trigger(NRF_SPIM0, NRF_SPIM_TASK_START);	
  • 1.You should start the next transmission in IRQHandler, and don't forget check the PTR boundary. 2.Yes, if MAXCOUNT is 8, you will get the interrupt after 8 bytes have been sent.

    So, if you need to send 46 bytes 8 times, you can set MAXCNT = 46. Then you start the first transmission , after that you start the next 7 times transmisson in IRQHandler.

  • OP mentions that he wants to transfer 46*8 bytes without interrupts, so just for the record, he doesn't need to use an interrupt to start the next transmission. It can be started using PPI channels and tasks and events, e.g. triggered by a timer or GPIOTE. Then you can use a counter to count the number of completed transmissions (still using PPI and tasks and events) and fire an interrupt after 8 transmissions. Here are some examples showing how EasyDMA, PPI, GPIOTE, timers, and counters can be used to trigger TWI transmissions from an accelerometer while the CPU is sleeping.

  • Yes, you are right. Using PPI+GPIOTE+TIMER pure periphs will have best power efficiency. I have thought about it and found SPI CS pin will need a little more tricks. e.g.If there is no Ext_INT( such as Data_Ready ) for triggering the transmission, you will need another TIMER CC[x] = 1 to trigger the next transmission and toggle CS pin.

  • Thank you Martin! I will try that. Tien, It worked that way but still I had to have all the interrupts. I used SHORT for time efficiency.

Related