Part Number: MSP432P401R
Tool/software: TI-RTOS
Hi,
I have previously tried to use ADC14 + DMA to sample two channels and have had no luck. Searching online lead me to the conclusion that it doesn't work, which is unfortuante but something I just have to live with. However, I was using SDK 1.40.xx when I looked into this, and since then ADCBufMSP432 has been updated to support DMA and multiple channels, but it doesn't work. It works fine for a single channel, but fails to sample any data on all but the first channel, which I'll describe below. I also cannot choose DMA when opening a specific instance of ADCBufMSP432 because useDMA is a HWAttr which applies for all invocations. This is rather annoying because it means I can't use DMA for a single channel session, and then not use it for a different sampling session later that requires multiple channels. Anyway, onto the bug..
I'm using simplelink_msp432p4_sdk_2_10_00_14, and in configDMA DMA is always configured to not increment the source:
pingpongTransfer->dmaChannel = DMA_CH7_ADC14;
pingpongTransfer->ctlOptions = UDMA_SIZE_16 | UDMA_SRC_INC_NONE |
UDMA_DST_INC_16 | UDMA_ARB_1;
pingpongTransfer->dmaTransferSource = (void *) &ADC14->MEM[0];
So immediately, we cannot get any data for subsequent channels because they have to be configured to sample into ADC14MEM1 - ADC14MEM31. And because of the way the ADC/DMA works on the MSP432, there's nothing we can do to make it work. We could configure it to sample into MEM0-MEM31, and then use DMA to copy it out, but that doesn't really achieve much because the processor has to wake up every 32 samples anyway.
So basically, what I'm saying is: how is this code ever meant to work? Has it ever been tested? This makes the ADCBufMSP432 driver basically unusable for me because I need to use DMA to sample a single channel at a high frequency, and then later on (after closing the single channel session), I need to sample multiple channels. This works fine without DMA, but not with DMA, and there's no way I can tell it not to use DMA because it's a HWAttr. I'm going to have to move the DMA HWAttrs into RAM and then change it before calling ADCBuf_open every time, which is a bit of a hack but will probably work around the issue.
Thanks
Campbell