cancel
Showing results for 
Search instead for 
Did you mean: 

[Solved] Reset a variable at fixed frequency

Myzhar
Associate III

Hi all,

I have a data streaming firmware and to keep the stream alive I must reset a counter before it reaches a fixed value.

Is there a way to perform this operation with CubeMonitor while monitoring other values?

Thank you

Walter

1 ACCEPTED SOLUTION

Accepted Solutions

Thanks your your answer. I have modified your flow accordingly, please find attached flow.

Here are the updates done in the flow :

There are plenty of good document to read. The first one is the STM32CubeMonitor wiki available at

https://wiki.st.com/stm32mcu/wiki/STM32CubeMonitor:STM32CubeMonitor_overview. It is updated on regular basis with questions/answer coming from the this forum.

If you want more explanation on node-red framework, there is the node-red website which provides plenty of information from beginner to expert : https://nodered.org/docs/

Hope it answers your question

View solution in original post

9 REPLIES 9
Thierry
Senior

Hi Walter,

Yes it should be possible since your know the counter address.

Indeed as STM32CubeMonitor is able to read but also write some values at various addresses, then you can implement a logic in your flow that reset your counter when a condition is reached.

Myzhar
Associate III

I think that I could use the "trigger" function, but I do not know how to use it

Thierry
Senior

Not sure the trigger can fit your needs. Could you please explain a bit more what you want to achieve and share your current flow such so that we can better help you ?

Myzhar
Associate III

The FW works in this way:

1) The host sends the "Start data acquisition" command over USB and that sets a variable to 1 to indicate that the stream is started

2) During the data acquisition the host must send a ping before 6 seconds to avoid that the stream stops, the ping resets a counter that is increased at 400Hz

I must simulate this behavior:

1) set the "start stream" variable to 1

2) reset the counter to zero before it reaches the value 2400

The shared flows does exactly what I said, but I must continuously press the "Write" button on the dashboard to keep the stream alive

Thanks will have a look and keep you informed.

I have few questions / clarification on your current flow/logic :

  1. starting the stream is done by setting sensStreamStatus.stream_status to 1. Correct ?
  2. you need to reset the counter be setting systemStatus.data_sample_not_pinged_count to 1 (or 0??) every 6 seconds. Correct ?
  3. do you really want to be able to write sensStreamStatus.stream_status & systemStatus.data_sample_not_pinged_count from the dashboard write widget or is it fine to do it only from the flow editor interface ?

  1. correct
  2. correct. Usually the host sends a ping every 1 second to reset `systemStatus.data_sample_not_pinged_count` to zero
  3. I do not need the dashboard. I only added it because it's the only way that I not to set the variables

I'm really new to nodered. Is there a good documentation to read about it that is helpful to better understand Stm32CubeMonitor?

Thank you again for your help

Walter

Thanks your your answer. I have modified your flow accordingly, please find attached flow.

Here are the updates done in the flow :

There are plenty of good document to read. The first one is the STM32CubeMonitor wiki available at

https://wiki.st.com/stm32mcu/wiki/STM32CubeMonitor:STM32CubeMonitor_overview. It is updated on regular basis with questions/answer coming from the this forum.

If you want more explanation on node-red framework, there is the node-red website which provides plenty of information from beginner to expert : https://nodered.org/docs/

Hope it answers your question

Thank you @Thierry​ 

it works as expected =)