Multiple SPIM sections using EasyDMA

My design is in alpha test and we just discovered that apparently SPIM allows only one module to be enabled at a time. When a second module (SPIM3, SPIM2) is enabled, the first turns off or the 2nd never turns on, depending on the relative priority of the two. Surely this can't be a restriction of the part, or there would be no reason to have multiple modules. Reducing the clock rates does not help. How can I run two (or more) SPIM modules simultaneously?

Parents
  • Post your dts overlay with the peripherial and pin configs. I can run multiple SPIM peripherials here - but its easy to make a mistake with the shared peripherials and the DTS checker won't catch all of them AFAIK.

  • I can't find any reference to "DTS checker" etc., so I must presume that's something in whatever IDE you're using. I'm using Segger. Below are snippets of my code that show what I'm doing with the SPIM. I have tried using different combinations of SPIM0 thru 3, and various clock frequencies. SPIM3, being highest priority, works best, but enabling any other SPIMx channel kills SPIM3.My code does not use any of the TWI, SPI, or SPIS channels that conflict with the SPIM channels.

    NRF_SPIM_Type *SPITable [Channels] = {NRF_SPIM3, NRF_SPIM2};
    NRF_SPIM_Type *SPI;

    SetPinCfg (PinNum [Ch], 0x00000303);
    SPI = SPITable [Ch];
       SPI -> TASKS_STOP = 1;
       SPI -> ENABLE = 0;
       SPI -> SHORTS = 1 << 17;
       SPI -> PSEL.SCK = (uint32_t) 0xFFFFFFFF; // disconnect Clk
       SPI -> PSEL.MOSI = PinNum [Ch];
       SPI -> PSEL.MISO = 0xFFFFFFFF; // Disconnect MISO
       SPI -> PSEL.CSN   = 0xFFFFFFFF;
       SPI -> FREQUENCY = SpiClkFreq [SpiClk [Ch]].Reg;
       SPI -> RXD.PTR = (uint32_t) &Dummy;
       SPI -> RXD.MAXCNT = sizeof Dummy;
       SPI -> RXD.LIST = 0;
       SPI -> TXD.PTR = (uint32_t) Buffer [Ch];
       SPI -> TXD.MAXCNT = NumBytes [Ch];
       SPI -> TXD.LIST = 0;
       SPI -> CONFIG = 0;
       SPI -> ENABLE = 7;
       SPI -> TASKS_START = 1;

  • I recommend migrating to VS code and the NCS SDK, which has support for Threads.

    BTW: I strongly suspect the problem in the very next line(s) to occur.

Reply Children
Related