2012-12-05 12:33 PM
Hi all,
Trying to trigger ADC conversion with a Timer, (8 kHz, to be exact).Without doing an annoying,12 page code dump here, how can I debug my app to make sure the Timer event is triggering the ADC conversion? I'm very new to debugging on this platform, so be gentle. Thanks.Edit: By debug, I mean, how can I look into the chip to see which flags are set for the ADC. I am thinking I could check the ADC status flag to see if it has performed, or is currently performing a conversion, but is there also a way to see the timer event firing? Do I just view the memory location of the ADC status register? I'm kinda looking for a platform independent answer, but for what its worth, I'm currently using Keil uVision4.2012-12-05 12:58 PM
8 KHz is going to be a bit of a bugger to do by eye.
You could look at the TIM channel outputs directly on the pins with a scope. You could reflect register bits to external pins/LEDs. You could catch the EOC interrupt from the ADC, toggling a pin in response. You could DMA out of the ADC into memory, and park a memory view/watch window over it. You could output telemetry via the serial port. Monitoring locations, registers, counts, etc.2012-12-05 01:36 PM
Thanks for that quick response! I've verified my timer is firing at 8 kHz by toggling an LED in the timer interrupt handler and putting a scope on it. Yes, I know that means my LED is blinking at 4 kHz ;)
Your list of suggestions got me thinking of some things to try out. Quick question on your serial port comment...can I just printf and have info appear in my IDE console? From what I understand, ARM debugging used properly can be quite powerful, and printf's are the clear sign of King N00b, but if its a starting point, whatever works works.Thanks again.2012-12-05 04:53 PM
Well you can certainly retarget the printf/putchar functions to use a serial port. The ARM9 parts had a DCC (Debug Com Channel), and the M3 has a SWV, although I've had kind of mixed results with the latter, and support for it on various debug pods.
http://www.keil.com/download/files/swv_on_cortex-m3.pdf
[DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32VLDiscovery/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32VLDiscovery/Auto-running%201024%20byte%20program%20from%20flash&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000491D59B8574F8049B5DFA3E8B21CBA51¤tviews=469]https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32VLDiscovery/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FSTM32VLDiscovery%2FAuto-running%201024%20byte%20program%20from%20flash&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000491D59B8574F8049B5DFA3E8B21CBA51¤tviews=469 See also retarget.c and serial.c examples in some of Keil's sample directories.2012-12-06 09:05 AM
Cool, thanks again.
BTW, got my issue sorted out. EXTEN[1:0] was never getting set correctly, thereby disabling any external triggering. Looked around a bit thru the ST Library docs and couldn't really find what function/struct parameter sets those bits. Oh, the perils of using someone else's library! :D2012-12-06 10:16 AM
Aaaaaaand I found it now, quite easily actually. What a wonder a cup of coffee will do... :)