2024-04-21 11:53 PM - last edited on 2024-04-26 04:13 AM by Sarra.S
Hi everyone,
I am trying to use LPTIM1 and I2C3 to read the values of a sensor's register every 1 second and save them into a data buffer while in Stop2 mode. What I would like to know is if it is possible to store data sampled at a given frequency in a data buffer, thus incrementing the offset value at each I2C transaction, without needing to add multiple I2C Receive boxes in the Queue. I would like to perform everything while in Stop2 mode and to wake up the uC only when the data buffer is completely filled with data.
I performed 3 tests using the NUCLEO-U575ZI-Q board, each of them is provided below as .rar files.
1st TEST (Test_00.rar in the attached files):
In the "Pinout & Configuration" view, I configured the LPDMA1 Channels 0 and 1 in Linked-List mode, enabled both LPDMA1 SmartRun Channel 0 and 1 global interrupts, and set CH0 and CH1 Execution Modes as Linear.
In the "LPBAM Scenario & Configuration" view, I configured the following peripherals:
Afterward, I created one scenario with 2 queues: one (Queue 1) hosting the LPTIM1 Start box, and the other one (Queue 2) hosting the I2C3 Transmission and I2C3 Receive boxes. The I2C3 Receive "Number of Data" is set as 10.
In the 'scenario_build.c' file, I initialize the data buffer (uint8_t Rx[10]) in which I would like the sensor data to be saved. Then, in the 'scenario_config.c' file, the LPTIM1 is started in the 'Scenario_Start' function while in the 'MX_Queue2_Q_DMA_TC_Callback' a UART transmission is performed to send all the data buffer values to a serial terminal, and the LPTIM1 is stopped. Finally, the LPBAM application-generated API call sequence (Init, Build, Link, Start) is performed in the 'main()' function.
With these settings, the Rx buffer is not filled with data sampled every 1 s, so it is not sent after 10 seconds; all the sensor values are instead read by a single I2C transaction and sent after 1 second.
2nd TEST (Test_02.rar in the attached files):
Both the "Pinout & Configuration" and the "LPBAM Scenario & Configuration" tabs are configured in the same way as in the first test. Also in this case, I created one scenario with 2 queues: one (Queue 1) hosting the LPTIM1 Start box, and the other one (Queue 2) hosting the I2C3 Transmission and I2C3 Receive boxes, as shown in the attached images. In this test, I have added as many I2C Receive boxes as my data buffer length (=10), each of them having "Number of Data" equal to 1 and increasing "Data Buffer Offset".
Only in this case, I was able to successfully save all the data into each element of the buffer each 1 second, thus receiving all the data after 10 seconds.
3rd TEST (Test_03.rar in the attached files):
Both the "Pinout & Configuration" and the "LPBAM Scenario & Configuration" tabs are configured in the same way as in the previous tests. Also in this case, I created one scenario with 2 queues: one (Queue 1) hosting the LPTIM1 Start box, and the other one (Queue 2) hosting the I2C3 Transmission and I2C3 Receive boxes, as shown in the attached images. However, in this test, the I2C3 Receive "Number of Data" is set as 1, and Queue 2 is set in Circular mode.
With these settings, only the first element of the Rx buffer is filled with data. I suppose that by enabling the circular mode all the sampled data is stored at the same memory address, thus all the acquired samples are overwritten at each I2C transaction. Of course, this also happens if I set the I2C3 Receive "Data Buffer Offset" with a value different than 0. In this case, the buffer is only filled in the position defined by the offset.
Furthermore, when using the xNUCLEO-LPM01A Power Shield to analyze the uC current consumption, I notice that, in each test, the uC correctly goes to Stop2 mode but it seems that it never wakes up since the current values remain around 800 uA.
Here are some additional questions:
- Is there an available project implementing data storage into a buffer in LPBAM? My search did not yield any results yet.
- I have noticed that the I2C3 parameters settings present an "Autonomous Mode" tab. What is it used for? I couldn't find any information online.
Thanks.
Best regards
2024-05-06 08:14 AM
Dear Ilaria,
Has anyone from ST helped you?
I am also interested in this topic, as I am having the same problems
I think that the low power capabilities of this micro are superb, but I find it difficult to get along with them.
Best regards,
A.
2024-08-14 08:35 AM
Did you solve it? I have the same problem