cancel
Showing results for 
Search instead for 
Did you mean: 

STEVAL-STWINBX1 datalogger board - add digital input for logging to SD card (to sync multiple DAQs)

johngj
Senior

I am using the STEVAL-STWINBX1 development board and have downloaded the FP-SNS-DATALOG2 software to the board.

Is it possible to add another channel, in this case a digital input that will be logged to the SD card ?

I need to synchronize the data logs from different DAQ systems including the STEVAL-STWINBX1

I was thinking if the STEVAL-STWINBX1 could log a GPS PPS (Pulse Per Second) digital signal, then I could manually (offline) sync its log with the logs from the other DAQ systems.

Or is there some other technique I can use to synchronize all these logs from different DAQ systems (e.g. IRIG, NTP, EtherCAT, PTP).

 

 

 

 

16 REPLIES 16
SimonePradolini
ST Employee

Hello @johngj 

Natively DATALOG2 firmware has not this feature.

But you can modify the firmware and exploit the pin exposed by the CN1 connector on the STEVAL-STWINBX1. Here you can find the schematic for reference.

I suggest you to start modifying the code from the "mx" folder, where you can also find the .ioc project for CubeMX. There, you are free to change the GPIO setup.

 

Best regards

Simone

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Thanks Simone, setting a pin to be a digital input is the easy part !

How would I go about logging that digital input to the SD card in stand alone mode ?

 

Hello @johngj 

Extending the log with external data is not automatically managed by FP-SNS-DATALOG2. I can suggest you a strategy to let you implement it.

FP-SNS-DATALOG2 provides firmware components called Tag Manager and Tags_Info_PnPL + App_model (see tags_info section). In this example, they are used to provide software tags, allowing labelling datasets. Those tags are then saved into the "acquisition_info.json" file in the acquisition folder.

I suggest you to implement the same schema: exploit the "TM...HSTag.." APIs from TagManager and extends Tags_Info_PnPL and App_model (tags_info section).

 

Feel free to come back for any further assistance.

Best regards

Simone

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

What would the latency be when using a digital input to trigger a software tag ?

In order to manually sync the STWINBX1 log with the other DAQ systems, there must be very little latency.

There will be a common sync signal between the STWINBX1 and other different DAQ systems...

johngj_0-1719848713626.png

 

The logs from each system will be manually synchronised using the common sync signal (e.g. using the falling edge)...

 

johngj_1-1719848862333.png

If there is a high (or variable) latency using a digital input to trigger the software tag, then it will not be possible to accurately sync the logs.

Hello @johngj 

GPIO latency should be very low. Once a Pin Toggle or Trigger function is invoked, the GPIO is setup in few MCU clocks. It should be about tens of microseconds, depending also on the firmware complexity and compiler optimization.

Which is the target time resolution you would achieve for log synchronization? Consider that DATALOG2 timestamps are in milliseconds.

 

Best regards

Simone

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

I assume the project for this board is "STM32L4R9ZI-STWIN" ?

johngj_0-1720084048697.png

 

For some reason I can't seem to step through the code and I don't think breakpoints are working (I am using a Segger J-Link base).

I set a breakpoint in the function 'tags_info_set_sw_tag0__status'....

johngj_1-1720084360851.png

 

I expected the software to stop here when I toggled the SW_TAG_0, but it didn't...

johngj_2-1720084525494.png

I don't know whether its an issue with the debugger (as I cant seem to step through or breakpoint the code), I also don't know if I am looking at the right place in the code for the tags ?

 

 

Hello @johngj 

First, let me confirm you that the project to be used is STM32U585AI-STWIN.box.

You placed the breakpoint in the right point, but it is expected to be toggled only while the acquisition is running. Have you already started the log when you'd look at the breakpoint?

Do you have the same issue by placing a breakpoint in other functions? For example, you can place it in SysLoadApplicationContext in App.c file: this function is invoked at the boot of the firmware, so it should be toggled just after the firmware startup.

 

Best regards

Simone

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Yes I ran the Python GUI, started the log and toggled all of the software tags, but it did not stop at the breakpoint.

I tried placing a breakpoint in SysLoadApplicationContext in App.c file, but it did not stop at the breakpoint.

Usually when I debug, by default it stops at a breakpoint in main once downloaded, but this does not happen when I debug FP-SNS-DATALOG2.

The console also show some errors - see below... 

JLinkARM.dll V7.96j (DLL compiled May 29 2024 15:36:36)

Command line: -port 2331 -s -device STM32U585AI -endian little -speed 4000 -if swd -vd
-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2331
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      localhost only
Generate logfile:              off
Verify download:               on
Init regs on start:            off
Silent mode:                   off
Single run mode:               on
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 none
J-Link settings file:          none
------Target related settings------
Target device:                 STM32U585AI
Target device parameters:      none
Target interface:              SWD
Target interface speed:        4000kHz
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V12 compiled May 28 2024 15:36:13
Hardware: V12.00
S/N: 52004513
Feature(s): GDB
Checking target voltage...
Target voltage: 3.25 V
Listening on TCP/IP port 2331
Connecting to target...
Halting core...
Core security extensions: Not implemented
Connected to target
Waiting for GDB connection...Connected to 0000:0000:0000:0000:0000:0000:0000:0001
GDB client (conn. 960) requested target.xml from GDB Server
Reading common registers: Read register 'r0' (4 bytes) from hardware: 0x4C340B20
Read register 'r1' (4 bytes) from hardware: 0x00000000
Read register 'r2' (4 bytes) from hardware: 0x50340B20
Read register 'r3' (4 bytes) from hardware: 0x00000000
Read register 'r4' (4 bytes) from hardware: 0x60010B20
Read register 'r5' (4 bytes) from hardware: 0x00000000
Read register 'r6' (4 bytes) from hardware: 0xE4010B20
Read register 'r7' (4 bytes) from hardware: 0xFFFFEFFF
Read register 'r8' (4 bytes) from hardware: 0x00000000
Read register 'r9' (4 bytes) from hardware: 0x00000000
Read register 'r10' (4 bytes) from hardware: 0x00000000
Read register 'r11' (4 bytes) from hardware: 0x00000000
Read register 'r12' (4 bytes) from hardware: 0x84090B20
Read register 'sp' (4 bytes) from hardware: 0x40430B20
Read register 'lr' (4 bytes) from hardware: 0xACFFFFFF
Read register 'pc' (4 bytes) from hardware: 0x181B0208
Read register 'xpsr' (4 bytes) from hardware: 0x0E000061
Read 4 bytes @ address 0x08021B18 (Data = 0x60016811)
Reading register 'msp' = 0x200B4340
Reading register 'psp' = 0x200B09E8
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF0001B
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF0001B
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF0000B
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00007
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00003
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00001
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF0000B
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00007
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00003
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00001
Received monitor command: ReadAPEx 0x0 0xF8
O.K.:0xE00FE003
Read 4 bytes @ address 0xE000EE08 (Data = 0x00000000)
Received monitor command: ReadMemAP 0x0 0xE00FEFD0 0x8 0x0
O.K.:0x00000000,0x00000000,0x00000000,0x00000000,0x00000082,0x00000004,0x0000000A,0x00000000
Connected to 0000:0000:0000:0000:0000:0000:0000:0001
GDB client (conn. 704) requested target.xml from GDB Server
Reading common registers: Read register 'r0' (4 bytes) from hardware: 0x4C340B20
Read register 'r1' (4 bytes) from hardware: 0x00000000
Read register 'r2' (4 bytes) from hardware: 0x50340B20
Read register 'r3' (4 bytes) from hardware: 0x00000000
Read register 'r4' (4 bytes) from hardware: 0x60010B20
Read register 'r5' (4 bytes) from hardware: 0x00000000
Read register 'r6' (4 bytes) from hardware: 0xE4010B20
Read register 'r7' (4 bytes) from hardware: 0xFFFFEFFF
Read register 'r8' (4 bytes) from hardware: 0x00000000
Read register 'r9' (4 bytes) from hardware: 0x00000000
Read register 'r10' (4 bytes) from hardware: 0x00000000
Read register 'r11' (4 bytes) from hardware: 0x00000000
Read register 'r12' (4 bytes) from hardware: 0x84090B20
Read register 'sp' (4 bytes) from hardware: 0x40430B20
Read register 'lr' (4 bytes) from hardware: 0xACFFFFFF
Read register 'pc' (4 bytes) from hardware: 0x181B0208
Read register 'xpsr' (4 bytes) from hardware: 0x0E000061
Read 4 bytes @ address 0x08021B18 (Data = 0x60016811)
Reading register 'msp' = 0x200B4340
Reading register 'psp' = 0x200B09E8
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF0001B
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF0001B
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF0000B
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00007
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00003
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00001
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF0000B
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00007
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00003
Reading 64 bytes @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00000
WARNING: Failed to read memory @ address 0xFFF00001
Received monitor command: reset
Resetting target
Downloading 564 bytes @ address 0x08000000 - Verified OK
Downloading 16072 bytes @ address 0x08000238 - Verified OK
Downloading 16048 bytes @ address 0x08004100 - Verified OK
Downloading 16144 bytes @ address 0x08007FB0 - Verified OK
Downloading 16160 bytes @ address 0x0800BEC0 - Verified OK
Downloading 16160 bytes @ address 0x0800FDE0 - Verified OK
Downloading 16128 bytes @ address 0x08013D00 - Verified OK
Downloading 16032 bytes @ address 0x08017C00 - Verified OK
Downloading 16048 bytes @ address 0x0801BAA0 - Verified OK
Downloading 16192 bytes @ address 0x0801F950 - Verified OK
Downloading 16080 bytes @ address 0x08023890 - Verified OK
Downloading 16032 bytes @ address 0x08027760 - Verified OK
Downloading 16032 bytes @ address 0x0802B600 - Verified OK
Downloading 15952 bytes @ address 0x0802F4A0 - Verified OK
Downloading 16064 bytes @ address 0x080332F0 - Verified OK
Downloading 16000 bytes @ address 0x080371B0 - Verified OK
Downloading 16048 bytes @ address 0x0803B030 - Verified OK
Downloading 16208 bytes @ address 0x0803EEE0 - Verified OK
Downloading 15968 bytes @ address 0x08042E30 - Verified OK
Downloading 16192 bytes @ address 0x08046C90 - Verified OK
Downloading 16160 bytes @ address 0x0804ABD0 - Verified OK
Downloading 16192 bytes @ address 0x0804EAF0 - Verified OK
Downloading 16144 bytes @ address 0x08052A30 - Verified OK
Downloading 16080 bytes @ address 0x08056940 - Verified OK
Downloading 16080 bytes @ address 0x0805A810 - Verified OK
Downloading 16064 bytes @ address 0x0805E6E0 - Verified OK
Downloading 16064 bytes @ address 0x080625A0 - Verified OK
Downloading 16048 bytes @ address 0x08066460 - Verified OK
Downloading 16080 bytes @ address 0x0806A310 - Verified OK
Downloading 16160 bytes @ address 0x0806E1E0 - Verified OK
Downloading 16128 bytes @ address 0x08072100 - Verified OK
Downloading 16112 bytes @ address 0x08076000 - Verified OK
Downloading 16080 bytes @ address 0x08079EF0 - Verified OK
Downloading 16096 bytes @ address 0x0807DDC0 - Verified OK
Downloading 16064 bytes @ address 0x08081CA0 - Verified OK
Downloading 16080 bytes @ address 0x08085B60 - Verified OK
Downloading 16080 bytes @ address 0x08089A30 - Verified OK
Downloading 16096 bytes @ address 0x0808D900 - Verified OK
Downloading 16096 bytes @ address 0x080917E0 - Verified OK
Downloading 16000 bytes @ address 0x080956C0 - Verified OK
Downloading 15920 bytes @ address 0x08099540 - Verified OK
Downloading 16032 bytes @ address 0x0809D370 - Verified OK
Downloading 16064 bytes @ address 0x080A1210 - Verified OK
Downloading 3668 bytes @ address 0x080A50D0 - Verified OK
Downloading 16344 bytes @ address 0x080A5F28 - Verified OK
Downloading 16320 bytes @ address 0x080A9F00 - Verified OK
Downloading 16033 bytes @ address 0x080ADEC0 - Verified OK
Downloading 8 bytes @ address 0x080B1D64 - Verified OK
Downloading 8 bytes @ address 0x080B1D6C - Verified OK
Downloading 4 bytes @ address 0x080B1D74 - Verified OK
Downloading 4520 bytes @ address 0x080B1D78 - Verified OK
Writing register 'pc' = 0x0806A5CC
ERROR: Programming failed (error code = 1) for block @ address 0x08000000 (90436056)
Read 4 bytes @ address 0x0806A5CC (Data = 0xFFFFFFFF)
Read 2 bytes @ address 0x0806A5CC (Data = 0xFFFF)
Read 2 bytes @ address 0x0806A5CE (Data = 0xFFFF)
Reading 64 bytes @ address 0x08062740
Read 2 bytes @ address 0x0806276C (Data = 0x7374)
Reading 64 bytes @ address 0x08062940
Read 2 bytes @ address 0x08062954 (Data = 0x4154)
Read 2 bytes @ address 0x0806274A (Data = 0x465C)
Reading 64 bytes @ address 0x08062700
Read 2 bytes @ address 0x0806272C (Data = 0x6E61)
Reading 64 bytes @ address 0x0805C380
Read 2 bytes @ address 0x0805C3F4 (Data = 0xD210)
Reading 64 bytes @ address 0x08062900
Read 2 bytes @ address 0x08062934 (Data = 0x6465)
Read 2 bytes @ address 0x08062916 (Data = 0x2F73)
Read 4 bytes @ address 0xE000ED14 (Data = 0x00000201)
Downloading 4 bytes @ address 0xE000ED14 - Verified OK
Reading common registers: ERROR: Cannot read register 0 (R0) while CPU is running
Read register 'r0' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 1 (R1) while CPU is running
Read register 'r1' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 2 (R2) while CPU is running
Read register 'r2' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 3 (R3) while CPU is running
Read register 'r3' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 4 (R4) while CPU is running
Read register 'r4' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 5 (R5) while CPU is running
Read register 'r5' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 6 (R6) while CPU is running
Read register 'r6' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 7 (R7) while CPU is running
Read register 'r7' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 8 (R8) while CPU is running
Read register 'r8' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 9 (R9) while CPU is running
Read register 'r9' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 10 (R10) while CPU is running
Read register 'r10' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 11 (R11) while CPU is running
Read register 'r11' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 12 (R12) while CPU is running
Read register 'r12' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 13 (R13) while CPU is running
Read register 'sp' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 14 (R14) while CPU is running
Read register 'lr' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 15 (R15) while CPU is running
Read register 'pc' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 16 (XPSR) while CPU is running
Read register 'xpsr' (4 bytes) from hardware: 0xEFBEADDE
WARNING: Failed to read memory @ address 0xDEADBEEE
ERROR: Cannot read register 17 (MSP) while CPU is running
Reading register 'msp' = 0xDEADBEEF
ERROR: Cannot read register 18 (PSP) while CPU is running
Reading register 'psp' = 0xDEADBEEF
WARNING: Failed to read memory @ address 0xDEADBEEE
Read 4 bytes @ address 0xE000EDFC (Data = 0x01000000)
Downloading 4 bytes @ address 0xE000EDFC - Verified OK
Reading common registers: ERROR: Cannot read register 0 (R0) while CPU is running
Read register 'r0' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 1 (R1) while CPU is running
Read register 'r1' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 2 (R2) while CPU is running
Read register 'r2' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 3 (R3) while CPU is running
Read register 'r3' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 4 (R4) while CPU is running
Read register 'r4' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 5 (R5) while CPU is running
Read register 'r5' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 6 (R6) while CPU is running
Read register 'r6' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 7 (R7) while CPU is running
Read register 'r7' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 8 (R8) while CPU is running
Read register 'r8' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 9 (R9) while CPU is running
Read register 'r9' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 10 (R10) while CPU is running
Read register 'r10' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 11 (R11) while CPU is running
Read register 'r11' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 12 (R12) while CPU is running
Read register 'r12' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 13 (R13) while CPU is running
Read register 'sp' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 14 (R14) while CPU is running
Read register 'lr' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 15 (R15) while CPU is running
Read register 'pc' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 16 (XPSR) while CPU is running
Read register 'xpsr' (4 bytes) from hardware: 0xEFBEADDE
WARNING: Failed to read memory @ address 0xDEADBEEE
ERROR: Cannot read register 17 (MSP) while CPU is running
Reading register 'msp' = 0xDEADBEEF
ERROR: Cannot read register 18 (PSP) while CPU is running
Reading register 'psp' = 0xDEADBEEF
WARNING: Failed to read memory @ address 0xDEADBEEE
Reading 64 bytes @ address 0x08068DC0
Read 2 bytes @ address 0x08068DF4 (Data = 0x6E6F)
Setting breakpoint @ address 0x0805C3F4, Kind = 2, Type = THUMB, BPHandle = 0x0001
Setting breakpoint @ address 0x0806272C, Kind = 2, Type = THUMB, BPHandle = 0x0002
Setting breakpoint @ address 0x0806274A, Kind = 2, Type = THUMB, BPHandle = 0x0003
Setting breakpoint @ address 0x0806276C, Kind = 2, Type = THUMB, BPHandle = 0x0004
Setting breakpoint @ address 0x08062916, Kind = 2, Type = THUMB, BPHandle = 0x0005
Setting breakpoint @ address 0x08062934, Kind = 2, Type = THUMB, BPHandle = 0x0006
Setting breakpoint @ address 0x08062954, Kind = 2, Type = THUMB, BPHandle = 0x0007
Setting breakpoint @ address 0x08068DF4, Kind = 2, Type = THUMB, BPHandle = 0x0008
Starting target CPU...

 

The debug settings are shown below...

johngj_0-1720174121936.png

johngj_1-1720174156817.png

johngj_2-1720174168702.png

johngj_3-1720174195894.png

johngj_4-1720174211713.png

Could the issue be something to do with the fact there are 2 flash banks for the firmware ?

 

 

Hello @johngj ,

please be sure that you are flashing the firmware on the first flash bank. 

Detailed instructions are available in the FP-SNS-DATALOG2 User Manual, chapter How to handle double bank flash memory.

I can't provide you support for Segger J-Link product: instead, I strongly suggest you to use an ST-LINK product.

 

Best regards

Simone

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.