cancel
Showing results for 
Search instead for 
Did you mean: 

Disable Double Tapping for SD Card Logging in Sensortile

RMojt.1
Associate II

Hi,

The code that I used for my SensorTile is : https://bit.ly/2XU08G8 (Just please click on the GET Software - I use the code in the folder of Data Log).

The code is for USB log and SD card log. For the SD card, it needs to double tap the SensorTile to trig it. However, the USB log works exactly after turning on the device. As for my project, I need to disable its double tap and just work right after turning on the SensorTile and log data on the SD card, the same as its USB in the provided software.

I am wondering if please let me know how can I change the software to enable its SD card logging logs right after turning on the SensorTile without triggering it with double tapping.

I really appreciate your time and help.

Looking forward to hearing from you soon.

John

8 REPLIES 8
niccolò
ST Employee

Hi John @RMojt.1​,

it seems the link you posted is not right (on the other topic you opened the link points to the general page of the SensorTile, and not to a specific firmware).

Anyway, you should check where the acquisition starts by debugging with an Integrated Development Environment.

That start is now triggered by the double tap, you just have to change the trigger to a line of code after the initialization of the board.

If you need further help, please, provide me with the correct link to the firmware you are using.

hope this helps.

RMojt.1
Associate II

Hi @niccolo.ruffini​ ,

Thank you very much for your response.

The code that I used is here: https://bit.ly/2XU08G8 (Just please click on the GET Software - I use the code in the folder of Data Log).

The code is for USB log and SD card log. For the SD card, it needs to double tap the SensorTile to trig it. However, the USB log works exactly after turning on the device. As for my project, I need to disable its double tap and just work right after turning on the SensorTile, the same as its USB in the provided software.

I am wondering if please let me know how can I change the software to enable its SD card logging logs right after turning on the SensorTile without trigging it with double tapping.

I really appreciate your time and help.

Looking forward to hearing from you soon.

John

RMojt.1
Associate II

@niccolo.ruffiniI can't delete my another related post. So, I am wondering if please provide your answer here.

Thanks

let's figure this out together:

  • the command DATALOG_CMD_STARTSTOP is the one that starts and stops the log (you canfigure it out by searching where the datalog is enabled)
  • the message with this command is generated in the main, slightly over line 200 (found searching for the command)
  • this part of the code is run IF the function DoubleTap() returns 1, so if a double tap is detected
  • now you have to substitute this function with some other control (for example you can set a flag in initialization and check if that is set instead of the double tap)
  • keep in mind that you should also reset the flag to avoid stopping the log with the same command (basic programming but with no way to stop the log) or change the command and implement a different way to stop the log (advanced programming)

hope this was what you were looking for.

have a nice day.

RMojt.1
Associate II

@niccolo.ruffini​ 

Hi Niccolo,

Thank you very much for your time and guide.

I could change it in a way that with a double tap it starts logging and doesn't stop with another taps and continue logging. However, the problem is that, it only record and close file whenever it detects another tap! I mean, if you start logging and don't close the file, it doesn't record the data!.

I want to change it in a way that when I double tap it, it start logging without being stopped after the first tap. Then, when my testing finished, it record data by turning off the SensorTile. I don't know how can I make it to close the file that be sensitive to the device shut down and not be sensitive to the second(even) double taps.

I am wondering if please guide me Niccolo..

Thanks so much,

John

we will try to work this out.

when you turn off the board the power is cut off, so it cannot save anymore (that is the reason the log started and stopped with the double tap).

so you have two options:

  • save the file with f_sync once in a while (the timing depends on your needs)
  • use another method to close the file before turning it off (a timer, a specific motion, a sound, that is your choice) but this will be harder to code

let me know if this helps you.

RMojt.1
Associate II

Hi @niccolo.ruffini​ 

Thank you very much for your response.

Actually, I don't know how and where to use sync_f. However, I want to write in the same created file in every sample that is received and close the file. For this purpose, I defined a flag and insert it in the "For Loop" of "WriteData_Thread". The "DATALOG_SD_Log_Enable()" open a file and "DATALOG_SD_Log_Disable()" close the file. I tried it several times to save the file, but I wasn't successful. I a wondering if please help me how can I open, save, and close the same file for any sample that is received to gather all data. This secures, even by turning off the device, it records all data.

Link for code: https://bit.ly/2XU08G8

Thanks so much and looking forward to hearing from you soon.

John

Hi @RMojt.1​ ,

If you set the flag in the initialization process, check if the file was opened correctly by setting breakpoints.

First thing is making sure that the flag is doing its job.

I'm sorry, I misspelt the function, it is f_sync. Here is a link that explains how to use it:

http://elm-chan.org/fsw/ff/doc/sync.html

So, if you use f_sync every time you write the file will be surely saved.

If you need help on programming with FreeRTOS you can check out this series of videos by ST that explains how to tackle these kind of problems:

https://www.youtube.com/watch?v=QGVAayFI5ZQ&list=PLnMKNibPkDnFeFV4eBfDQ9e5IrGL_dx1Q