Search found 7 matches

by radar_macgyver
Sat Jan 11, 2025 3:34 pm
Forum: General Support
Topic: Program runs out of memory after one too many objects created
Replies: 4
Views: 29832

Re: Program runs out of memory after one too many objects created

I realize this is an old post, but it looks like the OP is declaring the class as a local variable in main() which puts it on the stack. Unless the stack is made large (for main, that's defined in chconf.h), this will be an issue regardless of the SRAM size. Consider making the classes static, which ...
by radar_macgyver
Tue Jan 07, 2025 1:37 am
Forum: STM32 Support
Topic: STM32L1xx I2C driver enters I2C_LOCKED state
Replies: 1
Views: 20032

STM32L1xx I2C driver enters I2C_LOCKED state

On my STM32L152 project, I'm using one of the I2C units in master mode at 100 kHz in a PMBUS application (talking to a PMBUS compatible power supply). All communications with the I2C is in a single thread. I found that on some occasions, my firmware was locking up, usually when other threads ran in ...
by radar_macgyver
Tue Dec 20, 2022 12:29 am
Forum: Bug Reports
Topic: STM32L1xxx ADC HAL driver bug
Replies: 3
Views: 3755

Re: STM32L1xxx ADC HAL driver bug

Hello Giovanni,
Thank you for the quick turnaround. I did a git pull today and noticed that there was a patch to os/hal/ports/STM32/STM32L1xx/hal_adc_lld.c. Looks like there was a change, but the write is to the wrong register: ADC_SQR1_NUM_CH(grpp->num_channels) is being written to SMPR1 instead of ...
by radar_macgyver
Fri Dec 09, 2022 3:01 am
Forum: STM32 Support
Topic: How to use STM32L152 COMP
Replies: 5
Views: 2989

Re: How to use STM32L152 COMP

I added STM32_EXTI_REQUIRED to my halconf.h, even though this is normally something that's used by device drivers. After that, instead of directly writing the EXTI registers as I had previously, I could call

extiEnableLine(22, EXTI_MODE_RISING_EDGE | EXTI_MODE_FALLING_EDGE | EXTI_MODE_ACTION ...
by radar_macgyver
Tue Dec 06, 2022 10:24 pm
Forum: STM32 Support
Topic: How to use STM32L152 COMP
Replies: 5
Views: 2989

Re: How to use STM32L152 COMP

Thank you Giovanni, I looked up the relevant information in the EXTIv1 peripheral and wrote the following:

#define STM32_COMP_NUMBER 22
#define STM32_COMP_HANDLER Vector98
OSAL_IRQ_HANDLER(STM32_COMP_HANDLER)
{
OSAL_IRQ_PROLOGUE();

/* Clear the pending IRQ by writing a 1 */
EXTI->PR |= ~(EXTI ...
by radar_macgyver
Tue Dec 06, 2022 3:21 am
Forum: STM32 Support
Topic: How to use STM32L152 COMP
Replies: 5
Views: 2989

How to use STM32L152 COMP

I wish to use the COMP peripheral in an STM32L152RE to generate an interrupt. From other posts on the forum, I had found out about ChibiOS-Contrib, and the existence of a COMPv1 peripheral there. It looks like that LLD does not support the STM32L152 (it's meant for L0xx devices). I'm able to ...
by radar_macgyver
Tue Dec 06, 2022 12:40 am
Forum: Bug Reports
Topic: STM32L1xxx ADC HAL driver bug
Replies: 3
Views: 3755

STM32L1xxx ADC HAL driver bug

I think there's a bug in the STM32L1xxx device-specific ADC HAL driver.

When doing a multi-channel conversion in a sequence, only the first channel was getting converted. For example, I had a conversion group with num_channels = 4, SQ1 = CH4, SQ2 = CH8, SQ3 = VREF, SQ4 = SENSOR. When I run ...