STM32G0xx

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: barthess, RoccoMarco

Tabulous
Posts: 494
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 4 times
Been thanked: 13 times

STM32G0xx

Postby Tabulous » Tue May 17, 2022 3:57 pm

in the test hal there isnt any examples for the G series ? Is this fully suported ?

User avatar
Giovanni
Site Admin
Posts: 14056
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 990 times
Been thanked: 839 times
Contact:

Re: STM32G0xx

Postby Giovanni » Tue May 17, 2022 7:11 pm

Hi,

G0 examples are in the "multi" projects, no standalone projects for newer platforms (going to remove gradually old ones too).

Giovanni

Tabulous
Posts: 494
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 4 times
Been thanked: 13 times

Re: STM32G0xx

Postby Tabulous » Wed Jun 08, 2022 2:02 pm

trying to use ADCD1 on G071 device and getting this compile error, i'm using the example from the multi projects



adc.c:38:1: warning: missing initializer for field 'tr3' of 'ADCConversionGroup' {aka 'const struct hal_adc_configuration_group'} [-Wmissing-field-initializers]
38 | };
| ^
In file included from ../chibiOS/os/hal/include/hal_adc.h:101,
from ../chibiOS/os/hal/include/hal.h:300,
from adc.c:9:
../chibiOS/os/hal/ports/STM32/LLD/ADCv5/hal_adc_lld.h:351:29: note: 'tr3' declared here
351 | uint32_t tr3; \
| ^~~
../chibiOS/os/hal/include/hal_adc.h:146:3: note: in expansion of macro 'adc_lld_configuration_group_fields'
146 | adc_lld_configuration_group_fields;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

User avatar
Giovanni
Site Admin
Posts: 14056
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 990 times
Been thanked: 839 times
Contact:

Re: STM32G0xx

Postby Giovanni » Wed Jun 08, 2022 2:13 pm

Hi,

Which version? it compiles in 21.11.x (latest) and trunk.

Giovanni

Tabulous
Posts: 494
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 4 times
Been thanked: 13 times

Re: STM32G0xx

Postby Tabulous » Wed Jun 08, 2022 2:55 pm

Giovanni wrote:Hi,

Which version? it compiles in 21.11.x (latest) and trunk.

Giovanni


my bad was using wrong example

Tabulous
Posts: 494
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 4 times
Been thanked: 13 times

Re: STM32G0xx

Postby Tabulous » Wed Jun 08, 2022 2:59 pm

Do have another question

Using a in a gptimer callback can you start the ADC conversion ?

i.e.

static void gpt3Callback( GPTDriver *gptp )
{
adcConvert(&ADCD1, &portab_adcgrpcfg1, samples, ADC_GRP_BUF_DEPTH);
cacheBufferInvalidate(samples, sizeof (samples) / sizeof (adcsample_t));
}

Tabulous
Posts: 494
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 4 times
Been thanked: 13 times

Re: STM32G0xx

Postby Tabulous » Wed Jun 08, 2022 3:07 pm

Tabulous wrote:Do have another question

Using a in a gptimer callback can you start the ADC conversion ?

i.e.

static void gpt3Callback( GPTDriver *gptp )
{
adcConvert(&ADCD1, &portab_adcgrpcfg1, samples, ADC_GRP_BUF_DEPTH);
cacheBufferInvalidate(samples, sizeof (samples) / sizeof (adcsample_t));
}


sorted it with

adcStartConversion and adcStartConversionI

User avatar
Giovanni
Site Admin
Posts: 14056
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 990 times
Been thanked: 839 times
Contact:

Re: STM32G0xx

Postby Giovanni » Wed Jun 08, 2022 3:13 pm

Hi,

Correct, use adcStartConversionI() from callbacks and don't forget to enclose it in the proper lock/unlock (from ISR) functions.

When doing this kind of things make sure to enable the state checker in chconf.h, it catches all this kind of problems easily.

Giovanni


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 7 guests