Part Number: MSP430FR5739
Other Parts Discussed in Thread: MSP430WARE
Tool/software: Code Composer Studio
Hi, I'm using the ADC10 in repeated-single channel mode for convert two channels. I use the ADCIFG as trigger for DMA0, which is configured to get 8 ADC readings from ADC10MEM0 and transfering to a buffer using DMA0SZ=8. I start conversion for a channel (e.g A0) five times and then read another channel (e.g. A1). The problem I found is that the buffer contains two readings from previous conversions, for example:
t=1, A0_buffer=[490, 491, 490, 491, 489, 490, 490, 491]
t=2, A0_buffer=[490, 491, 480, 481, 482, 480, 480, 481]
t=3, A0_buffer=[480, 481, 490, 491, 489, 490, 490, 491]
t=4, A0_buffer=[490, 491, 480, 481, 481, 480, 480, 481]
t=5, A0_buffer=[480, 481, 490, 491, 489, 490, 490, 491]
t=5, A1_buffer=[490, 491, 690, 691, 689, 690, 690, 691]
t=6, A0_buffer=[690, 691, 490, 491, 489, 490, 490, 491]
This example supposes that at t1, t3, t5 and t6, reading at channel A0 are around 490, and for t2 and t4, readings for channel A0 are ~480. Channel A1 is supposed to be at ~690.
These are the steps I am following to do this:
1. Configure DMA (destination address),
2. Configure ADC (channel),
3. Enable DMA
4. Start ADC conversions.
5. When DMA interrupt is active, disable ADC
After doing some debugging I found that the first time I run the program (t1) in step 3, DMA0SZ=8 then in step 4, DMA0SZ remains the same. In the second cycle (t2), DMA0SZ=8 in step 3 but after enabling DMA with DMAEN bit and steping to the next line, DMA0SZ changes to 6. This explains why two readings are wrong in the final buffer.
Any hint on this issue?