Showing results for 
Search instead for 
Did you mean: 

STWIN Trigger USR button via Firmware

Associate III

Hi, im using the FP-SNS-DATALOG1 firmware for measuring sensor data and another custom firmware for other ML tasks. Furthermore, i am implementing a bootloader to switch between both softwares. 

I want to measure automaticaly and in order to do so i need to trigger the sampling via software (not with pushing the USR button). How can i implement that? I compiled the Project file from your github repository and i would now try to create a new binary (.elf) to use as firmware on my evaluation board. Is there an easier/quicker way?

ST Employee

Hello @TomRett 

I'm not sure I got the question: are you missing the .elf file when compiling the CubeIDE project? Once compiled, .elf and .bin are available in Debug folder generated by CubeIDE at compile time.


Best regards


Hello @SPRAD.1, i have the binary file so that is not the question. Nonetheless, i want to use the application's code to measure with just the IMP23ABSU microphone automatically instead of pressing the USR button as in the usual case. Looking into the imp23absu_app.c, i see a few potential functions that could work in my favour (IMP23ABSU_Start, IMP23ABSU_StartAcquisition). However, i see that in the main.c that after starting scheduler the system "ignores" the code below (or at least it doesnt reach there under specific conditions) 


How can i trigger the measurement automatically and save the data to the SD card? I want to let the IMP23ABSU microphone to sample for 5 seconds after which i will invoke NVIC_SystemReset(); to jump back to my bootloader.


Thanks in advance!


Hello @TomRett

DATALOG1 also features the Automode, which can be initiated automatically at device power-up or reset. This mode can be used to start the datalog operations or to pause all the executions for a specific period of time by putting the sensor node in "idle" phase. See the User Manual for the full description.

You can exploit this feature and modify the Automode and AutoModeTask files for your purposes.


Best regards


Im trying this now. Why am i not getting any printf results on the COM port? Do i have to enable something before? I cant see where i would be abble to add my system reset inside Automode.c. This file seems to only read the execution_config.json.

  1. Where should i invoke the system reset (NVIC_SystemReset()) inside AutoModeTask.c or AutoMode.c?
    1. Inside AMTaskStartDatalog(AMTask *_this) after execution?
    2. Inside AMOnNewConfigurationReady()
    3. Inside StartStop_AutoMode()?
    4. Inside AMTaskIsEnded()?
Associate III

Furthermore, after i switch from the bootloader address to the flash address of HSDatalog, the firmware doesnt start auto acquisition. The address start address (0x08019000) in the linker is set correctly and the offset fir VTOR (0x19000) aswell. Am i missing something important here?

Associate III

Can someone tell me how to start the FP-SNS-DATALOG1 software **without** pressing the RESET button?

ST Employee

Hello @TomRett 

DATALOG1 is not meant to handle natively your requirements. We can give you some hints and you are free to modify the code for your purposes, but then we can't offer a one-to-one support for customization.

In reply to all your requests:

  • printf are disabled by default. You must enable the proper macros (i.e.: HSD_PRINTF_DEBUG in main.h). printf then will be routed to the UART via the external ST-LINK.
  • You are right regarding Automode: it handles the execution_config file and parameters setup. You can customize Automode and AutoModeTask by adding a new state (as for now there is only 'datalog' and 'idle') or by inserting the NVIC_SystemReset in the 'idle' routine in AutoModeTask (AMTaskStartIdle).
  • You must setup properly addresses in both firmwares. Are you sure you are using the 2 flash banks properly?
  • DATALOG1 starts at the system boot. What do you mean by "start without pressing RESET?


Best regards


Hi @SPRAD.1 

  • I set HSD_PRINTF_DEBUG to 1 in main.h, but i still can not view any output on the console



  * User can change here printf with a custom implementation.
  * For example:
  * #define HSD_PRINTF(...)   MY_PRINTF(__VA_ARGS__)
#include <stdio.h>
#define HSD_PRINTF(...)                printf(__VA_ARGS__)


  • To add NVIC_SystemReset worked perfectly, thanks
  • The addresses were right and i verified the jump into the HSDatalog firmware using the LEDs on the eval. board as indicator (because i still cant printf)
  • Here comes the tricky part about "RESET". As already mentioned, i am able to jump from the Bootloader to the HSDatalog firmware just fine. However, the system seems to get stuck on the osKernelStart();. I verified that this is not the case, if i start with the HSDatalog firmware first. Herefore i have to erase the flash of the chip first, using STM32CubeProgrammer, and upload the firmware by running the main.c. So the system works in AutoMode if i start with the HSDatalog firmware instead of the Bootloader firmware. This is not what the desired outcome.

I have viewed the UM2688 multiple times where i found that:


That is why im asking about "RESET". How can i reset the HSDatalog firmware, as suggested by the documentation, in order to correctly run measurements? I think that the reason for my stuck osKernelStart() is due to the missing reset (or am i totally wrong?).


The HSDatalog source code used is the latest version from the Github repository. Im using FP-SNS-DATALOG1.