Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


Trying to figure out why my timer only ticks once

Greetings,

Relatively new to the platform, I’m trying to write a simple ‘blinkenlight’ test on an iM880A LoRa development board, which uses a STM32 chip.

I’m trying to do this using a Timer implementation, but for some reason, the timer only ticks once.

See also the attached cpp file.

I know that send_message is called once, because the led lights up after programming.
Removing ‘GpioWrite(&sensing_flag, flagState);’ on line 110 has the effect that the led does not light up.
Starting the code with ‘int flagState = 1;’ on line 21, causes it to set it to 0 and the led still does not light up. I know the chip is doing something, because adding a simple counter in the main loop that counts to 100000 and updating the state causes the led to actually blink.

Any insights in the situation are cheerfully appreciated. :-)

France

Hi,

How did you create your project? It does not seem to be a CubeMX-generated project neither a System Workbench generated one, or at least you do not use the firmwares provided by ST; you should have includes of the firmware definition files for your microcontroller.

I don’t know what the TimerInit and TimerSetValue do exactly, but I wonder if they do not initialize the timer in one-shot mode... I don’t know either what the TimerLowPowerHandler is doing.

Also, in send_message, I would probably just write
flagState ^= 1;


Bernard (Ac6)


The project is an attempt to create a boilerplate from (probably) known good code. (Colleague of mine left without leaving behind a lot of knowledge)
I was kind of afraid for this already, but it would appear that the libraries I’m using (the ones from imst.com for this devboard) are too product specific for the question to be asked here. Timer- functions are defined in those libraries as well, but I was just hoping that Timer-based things were common enough to be known here.


flagState ^= 1 tip: Thanks. :-)

You need to provide more context. By “timer” are you refering to one of the hardware timers or something like a software timer for a RTC that “ticks” periodically? Speaking from experience, if it’s a hardware timer, it has to have a clock source. If that source is not internal, then maybe your external source is not connected or not working. If it’s something that gets an interrupt each time, then maybe the interrupts were not cleared to reenable them. Same goes for software timers, which are usually triggered by a hardware timer (e.g. to “tick” every X msec): if the hardware timer was not set correctly, then that could be the problem. Or if it’s OK, then the interrupt for the “tick” was not cleared for the next tick event. If’s always better to provide more details, then not enough. It’s like aliasing when sampling analog signals for DSP, if you sample slower than the Nyquist rate, you most likely will not get what you wanted (unless you intentionally undersampled because it then aliases into a clean part of the spectrum), but I am providing too much detail.