3

I have problem with reading LPC1788 ADC pins in multichannel with DMA. Here is the procedure I have followed.

I use Keil, initialized UART 0 peripheral, have set all of the ADC pins to be analog, set all ADC pins to be opendrain, disabled all interrupts for ADC, then enabled all of the ADC channels. Next start the ADC in burst mode.

Then configured the DMA channel 0 to be used for ADC and channel 1 for UART. Set an "unsigned int buffer[8]" for ADC results. Setup DMAs and start each channel.

Now the problem is buffer is not filled in the right order from ADC channel 0 to channel 7. instead it filled in random, mess and chaos. For example the order is "0,1,5,7,6,0,3,2"

V.Ajall
  • 69
  • 4
  • (1) Let us read the datasheet first: LPC178x/7x 32-bit ARM Cortex-M3 microcontroller; up to 512 kB flash and 96 kB SRAM; USB Device/Host/OTG; Ethernet; LCD; EMC Rev. 5.5 — 26 April 2016 Product data sheet https://www.nxp.com/docs/en/data-sheet/LPC178X_7X.pdf – tlfong01 Dec 17 '21 at 13:19
  • (2) You seem to be doing too many things at the same time. I would suggest to test with as less things as possible, (a) Forget the UART part, just test ADC, (b) Test single channel instead of multi-channel, (c) Select just one ADC channel, say #5, and see if it can be put in the buffer. If OK, then try two ADC channels, and so on. – tlfong01 Dec 17 '21 at 13:24
  • (c) Do ADC single shot mode, instead of continuous/burst mode, because it is easier to troubleshoot this way. – tlfong01 Dec 17 '21 at 13:32
  • 1
    @tlfong01 I have followed all of them in advance. What I do now is to change the active channel in dma interrupt and it works. in this case only one channel is active. it is like polling but at a rapid pace. The main problem is in the multichannel case which fills the buffer randomly. – V.Ajall Dec 17 '21 at 13:52
  • 1
    @tlfong01 The working method problem is that the continuity of data is not maintained. – V.Ajall Dec 17 '21 at 13:59
  • Many thanks for your update and advice. It is nice to hear that you seem to be making some progress. I do not quite appreciate your problem at this point, because I have very little knowledge and experience in DMA interrupt. So I am sorry that I can no longer suggest any helpful troubleshooting tricks. I do have the feeling that you are almost there. Don't work too hard. Have a nice weekend. Cheers. – tlfong01 Dec 17 '21 at 14:38

0 Answers0