This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
Is it possible for the MSP430 (MSP430fr5969) to do ADC sampling while writing into RAM. I understand that the ADC is internal ( controlled by CPU) and the MSP430 has a DMA which can write data from memory to ADC without the help of CPU but can the MSP430 be coded to do a computation while doing sampling or memory writing?...
I am using Code Composer Studio and how to write a code for such kind of a parallel execution?...
I need to get the power required using energy trace for the ADC, CPU
Krishna Balaji said:Is it possible for the MSP430 (MSP430fr5969) to do ADC sampling while writing into RAM.
That is the whole point of the DMA engine. It offloads interrupt processing by the CPU when all that needs to be done is to move samples from the peripheral to memory. So, yes it is possible. There is one caveat though, and that is that the CPU can't access the bus during the time the sample is actually being moved. But this is only a few clock cycles of time the CPU is stalled compared to the many required to save context, execute the ISR, and restore context.
Krishna Balaji said:I am using Code Composer Studio and how to write a code for such kind of a parallel execution?...
That's a pretty open-ended question. But you do this the same as you would any other system using interrupts. You need to configure the ADC and DMA engines properly as part of the startup. Once that is kicked off your program can do it's background processing loop. You would handle the DMA interrupt to do things like setting a flag for the background loop to check (so it knows to do something with the sample buffer) and restart the ADC/DMA process (usually with a secondary buffer, so you can process the first while accumulating the second).
In addition to that, if your background loop runs out of things to do, it should go into an appropriate LPM mode until an interrupt occurs that gives the background loop more to do.
Brian,
Thanks for the reply. You have said both the ADC and DMA can be used like a background processing. DMA part is now very clear to me. But the MSP430 has a integrated ADC with the CPU so i would like my CPU to do some multiplication and addition operations in nested for loops and at the same time do the ADC sampling?... Can the CPU of MSP430 manage to do both the stuff simultaneously ?...Does it depend upon how I invoke the ADC?...
Regards,
Krishna
The ADC has its own internal state machine, so after setting it up and starting the process, the ADC does its job in the background. Once a result is available, it is presented in the result register(s) (indicated by an interrupt flag) and can be copied by CPU or DMA.
**Attention** This is a public forum