Hi everyone,
I'm using ChibiOS 16.1.4, and the board I'm using is STM32F0 Discovery (STM32F051R8).
I was trying to use both ADC and GPT, but when I was trying to run adcStartConversion() and gptStartContinuous() for the following pairs, my program stopped working:
- ADCD1, GPTD1
- ADCD1, GPTD14
Since I'm using my GPTD3 for other use, and ST requires GPTD2 (when I tried to use GPTD2 st_lld.c raised an error during compilation), I don't know what else to do.
Has anyone run into the same issue? Any suggestion on what to do?
Thanks!
- Sam
ADC1, GPT1/14 Conflict on STM32F0
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: ADC1, GPT1/14 Conflict on STM32F0
Hi,
You can disable the tickless mode in chconf.h, this way TIM2 is free for other drivers, also put tick frequency to 1000.
Giovanni
You can disable the tickless mode in chconf.h, this way TIM2 is free for other drivers, also put tick frequency to 1000.
Giovanni
-
samtatasurya
- Posts: 22
- Joined: Sun Nov 29, 2015 8:13 pm
Re: ADC1, GPT1/14 Conflict on STM32F0
Giovanni wrote:Hi,
You can disable the tickless mode in chconf.h, this way TIM2 is free for other drivers, also put tick frequency to 1000.
Giovanni
Thank you for the suggestion, Giovanni.
Just to verify, does that mean if I put the tick frequency to 1000, the system tick boundary will be 1 mS? If originally it is 10000, does that mean the current tick boundary is 100 uS?
Also, is there any chance that I can still use the other GPTs (GPT 1 & 14) together with ADC 1?
One thing that I also notice is that the order of function call results in different behavior.
Case 1 results in the system being stuck around GPT function calls:
Code: Select all
adcStart(&ADCD1, NULL);
adcStartConversion(&ADCD1, &adcgrpcfg, samples, ADC_GRP_BUF_DEPTH);
gptStart(&GPTD3, &gpt3cfg);
gptStartContinuous(&GPTD3, GPT3_INTERVAL);
Whereas in case 2, all functions called successfully:
Code: Select all
gptStart(&GPTD3, &gpt3cfg);
gptStartContinuous(&GPTD3, GPT3_INTERVAL);
adcStart(&ADCD1, NULL);
adcStartConversion(&ADCD1, &adcgrpcfg, samples, ADC_GRP_BUF_DEPTH);
Your insight is greatly appreciated.
- Sam
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: ADC1, GPT1/14 Conflict on STM32F0
Correct about systick.
About ADC and GPT, I suggest to start driver first, the start conversion, then start the timer. The reason is hidden in the STM32 technical details and quirks.
Giovanni
About ADC and GPT, I suggest to start driver first, the start conversion, then start the timer. The reason is hidden in the STM32 technical details and quirks.
Giovanni