Unfortunately it's still locking in the same place.
I have copied over the Makefile, mcuconf, halconf, osalconf from the f446re nucleo64 board example, and linked it to the latest trunk version (@9401)
About the only change I made to the mcuconf was setting STM32_ADC_USE_ADC1 to TRUE
and modified halconf to set HAL_USE_ADC to TRUE
I added my test project source.
Do you think it might be an issue with using os-less hal?
ADC conversion blocks in osless HAL Topic is solved
Re: ADC conversion blocks in osless HAL
- Attachments
-
- hal-adc_f446re.tar.gz
- (7.27 KiB) Downloaded 403 times
Re: ADC conversion blocks in osless HAL
duststorm wrote:Do you think it might be an issue with using os-less hal?
It appears not.
I attached an example using the RT os, it has the same issue.
I made a minimalist example, based very much on the f446re demo, where I try to do an ADC conversion in the main loop.
Doing the conversion makes it block in _idle_thread() indefinitely, and the led stops blinking.
Commenting out the conversion, the led blinks.
Uncomment the line #define USE_TEST_THREAD in main.c to run the blinker from a thread, otherwise it runs in the main loop.
They both have the same effect. Doing ADC conversion stops the thread indefinitely.
- Attachments
-
- rt-adc_f446re.tar.gz
- (10.35 KiB) Downloaded 439 times
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: ADC conversion blocks in osless HAL
Could you try the ADC demo in the ChibiOS /testhal directory?
Giovanni
Giovanni
- RoccoMarco
- Posts: 655
- Joined: Wed Apr 24, 2013 4:11 pm
- Has thanked: 83 times
- Been thanked: 67 times
Re: ADC conversion blocks in osless HAL
Hey,
there are still some uncertainties I have discovered in your project:
Is quite different from mine.
I can continue but saving my time and your I have tested ADC official demo on the STM32F446 Nucleo64 here attached.
It works on trunk. Of course check the CHIBIOS path when you will use it. I have noticed you are not working on ChibiStudio. Otherwise just copy it in workspace_trunk an import it.
I am marking this like solved. Let me know if it isn't.
Ciao,
RM
there are still some uncertainties I have discovered in your project:
Code: Select all
#define ADC1_CH1 0
#define ADC1_CH2 2
static const ADCConversionGroup adccg1 = {
TRUE,
ADC_CH_NUM,
adccb,
adcerr,
0, // CR1
ADC_CR2_SWSTART, //CR2
0, // SMRP1
ADC_SMPR2_SMP_AN0(ADC_SAMPLE_56), ADC_SMPR2_SMP_AN0 (ADC_SAMPLE_56), // SMRP2
ADC_SQR1_NUM_CH(ADC_CH_NUM), // SQR1
0, // SQR2
ADC_SQR3_SQ2_N(ADC1_CH1) | ADC_SQR3_SQ1_N(ADC1_CH2) // SQR3
};
Is quite different from mine.
- In first place if you intend to use PA0 and PA1 it should be
Code: Select all
#define ADC1_CH1 0
#define ADC1_CH2 1
Note that there are some beautiful macro already defined which you can use (ADC_CHANNEL_IN0, ADC_CHANNEL_IN1 and so on). - In second place
Code: Select all
ADC_SMPR2_SMP_AN0(ADC_SAMPLE_56), ADC_SMPR2_SMP_AN0 (ADC_SAMPLE_56), // SMRP2
here you should receive a warning for struct excess. These bitmasks should be in bitwise OR evenmore you hare setting two time sample rate for the same channel (AN0). - You are not using my board files. It is shown clearly in this code
Code: Select all
palSetPadMode(GPIOA, GPIOA_PIN0, PAL_MODE_INPUT_ANALOG); // adc channel 0, pa0, adc1 ch1
palSetPadMode(GPIOA, GPIOA_PIN1, PAL_MODE_INPUT_ANALOG); // adc channel 1, pa1, adc2 ch1
GPIOA_PIN0 doen't exist anymore. Now there is GPIOA_ARD0
I can continue but saving my time and your I have tested ADC official demo on the STM32F446 Nucleo64 here attached.
It works on trunk. Of course check the CHIBIOS path when you will use it. I have noticed you are not working on ChibiStudio. Otherwise just copy it in workspace_trunk an import it.
I am marking this like solved. Let me know if it isn't.
Ciao,
RM
- Attachments
-
- RT-STM32F446RE-NUCLEO64-ADC.zip
- (16.43 KiB) Downloaded 431 times
Re: ADC conversion blocks in osless HAL
Okay, thanks. I'll have a try.
I am, but I added these two defines to mcuconfig.h to minimise changes to my code.
That's correct, I'm developing on linux using a gcc and openocd toolchain.
RoccoMarco wrote:[*]You are not using my board files. It is shown clearly in this codeCode: Select all
palSetPadMode(GPIOA, GPIOA_PIN0, PAL_MODE_INPUT_ANALOG); // adc channel 0, pa0, adc1 ch1
palSetPadMode(GPIOA, GPIOA_PIN1, PAL_MODE_INPUT_ANALOG); // adc channel 1, pa1, adc2 ch1
GPIOA_PIN0 doen't exist anymore. Now there is GPIOA_ARD0[/list]
I am, but I added these two defines to mcuconfig.h to minimise changes to my code.
RoccoMarco wrote:I have noticed you are not working on ChibiStudio. Otherwise just copy it in workspace_trunk an import it.
That's correct, I'm developing on linux using a gcc and openocd toolchain.
- RoccoMarco
- Posts: 655
- Joined: Wed Apr 24, 2013 4:11 pm
- Has thanked: 83 times
- Been thanked: 67 times
Re: ADC conversion blocks in osless HAL
It seems to work now! 
Apparently I did not fully understand these configuration bits yet. I think I got the hang of them now.
Thank you for helping me out!
It's also working without OS.
Apparently I did not fully understand these configuration bits yet. I think I got the hang of them now.
Thank you for helping me out!
It's also working without OS.