I have a shell which is spawning a adc thread. If i set it to synchronous with no callback, the code executes, however when adding a callback the program crashes on adcStartConversion.
Code: Select all
#define ADC_GRP1_NUM_CHANNELS 1
#define ADC_GRP1_BUF_DEPTH 8
#define ADC_GRP2_NUM_CHANNELS 4
#define ADC_GRP2_BUF_DEPTH 16
static const ADCConversionGroup adcgrpcfg1 = {
FALSE,
ADC_GRP1_NUM_CHANNELS,
adcTempCallBack,
adcErrorCallBack,
ADC_CFGR1_RES_12BIT, /* CFGRR1 */
ADC_TR(0, 0), /* TR */
ADC_SMPR_SMP_1P5, /* SMPR */
ADC_CHSELR_CHSEL10 /* CHSELR */
};
void hello(void)
{
chprintf((BaseSequentialStream*)&SD1, "5787766");
}
void adcTempCallBack(ADCDriver *adcp, adcsample_t *buffer, size_t n)
{
hello();
(void)adcp;
hello();
}
void adcErrorCallBack(ADCDriver *adcp, adcerror_t err) {
chprintf((BaseSequentialStream*)&SD1, "Hello World17");
chThdSleepMilliseconds(500);
(void)adcp;
(void)err;
}
Also- I am using os x, stm32f0 discovery, st-util and arm-eabi-none I cannot get the program to run through gdb. It loads fine however i need to unplug the device to see the program run. (which kills the debug connection)
Code: Select all
(gdb) tar ext :4242
Remote debugging using :4242
0x08000240 in ?? ()
(gdb) load ./build/ch.elf
Loading section startup, size 0xc0 lma 0x8000000
Loading section .text, size 0x2db4 lma 0x80000c0
Loading section .data, size 0x1c lma 0x8002e78
Start address 0x8000240, load size 11920
Transfer rate: 7 KB/sec, 3973 bytes/write.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program:
0x2000002e in ?? ()
(gdb)
Thanks