2021-05-15 11:30 AM
Hello,
I am using STM32L0 MCU and trying to write a code which would include:
The problem is that if I use HAL_Delay function for periodical transmission of data1, then program is blocked from constant waiting for data2.
Now I am using timer for periodical transmission every second but I do not know how to change timer period value to other which is received from UART.
I would like to have opportunity to change time periods to 1, 5, 10 or 30 minutes.
Maybe you have some thoughts how such program could be implemented?
2021-05-15 04:54 PM
Tuner period is given by TIMx_ARR, you can simply rewrite it, but use preload (TIMx_CR1.ARPE=1) to avoid problem with setting it lower than the current CNT.
Use an appropriate prescaler to allow the range you want to achieve.
JW
2021-05-15 07:50 PM
Thank you for the answer, I will try to rewrite timer period.
2021-05-17 01:39 PM
Now I noticed that a problem occurs when data1 (which I periodically send to UART) consists of two symbols, for example 'AA' or '10'. In such case reception of data2 is blocked and does not not work untill I reprogram/reconnect my STM32 MCU.
I use LL API to accomplish USART communication. Here are lines for periodical data transmit and constant reception mode:
In such case data reception is blocked because number 10 is transmitted. When I change 10 to 9, everything works well. Could you help me to solve this problem?