Sd card sensor data
Answer
12/2/16 2:18 AM

Hi all,

I am pretty new to coding so bear with me, but is there a way to record sensor data (specifically Gyro data) and then write to and SD card? I have tried playing around with the SdCardExample program and I can write lines of text but not live sensor data.

I was wondering if anyone has done this before or has any suggestions.

Thanks,

Eric

0 (0 Votes)
RE: Sd card sensor data
Answer
12/2/16 11:05 AM as a reply to Eric Zhong.

Hello Eric,

welcome to the XDK community. There are generally two ways to implement your use case.
You can indeed start with the SdCardExample and adapt it to your needs, but you can also start with the DataloggerDemo that is available by download in XDK community you can find here.

I recommend to go through the Workbench First Steps Guide, the XDK Guide FreeRTOS and the XDK Guide Sensors you can find here to get familiar with the programming of the XDK.

I hope this could help you and good luck with your project.

Kind regards,
Franjo

0 (0 Votes)
RE: Sd card sensor data
Answer
12/2/16 9:34 PM as a reply to Franjo Stjepandic.

Hi Franjo,

Thank you for your advice I will check it out!

 

Eric

0 (0 Votes)
RE: Sd card sensor data
Answer
12/2/16 11:00 PM as a reply to Eric Zhong.

Hi Franjo,

Sorry to bother you again, I have tested out the Data Logger Demo and I have encountered an issue. When I put the microSD into the sensor and flash the program it does not create a .csv file on the sd card. I have also put the logger.ini file on the card, and the card is formatted for FAT32. I am using a windows computer. Also, I have edited the logger.ini to only enable the BMG160 sensor (gryo) but it seems the console outputs all of the unenabled sensors besides this one.

Here is the console output:

 INFO | Connection to port 'COM4' established
 INFO | Flashing file 'C:/Users/Feng/Desktop/XDKDatalogger_v2/XDK/src/DDL_demoDataLogger/debug/DDL_demoDataLogger.bin'...
 INFO | Application checksum '1fdd' successfully verified.
 INFO | Transmission successfully completed!
 INFO | Booting application...
 INFO | XDK DEVICE 1:  Jumping to application
 INFO | Connecting to XDK device 'XDK Device 1' in port 'COM4'...
 INFO | Connection to port 'COM4' established
 INFO | XDK DEVICE 1:  config.bmi160_enabled: 0
 INFO | XDK DEVICE 1:  config.bmi160_bandwidth_accel: 500
 INFO | XDK DEVICE 1:  config.bmi160_bandwidth_gyro: 32
 INFO | XDK DEVICE 1:  config.bmi160_range: 16
 INFO | XDK DEVICE 1:  config.bmi160_sampling_rate_timer_ticks: 1
 INFO | XDK DEVICE 1:  
 INFO | XDK DEVICE 1:  config.bmm150_enabled: 0
 INFO | XDK DEVICE 1:  config.bmm150_data_rate: 25
 INFO | XDK DEVICE 1:  config.bmm150_sampling_rate_timer_ticks: 5
 INFO | XDK DEVICE 1:  
 INFO | XDK DEVICE 1:  config.bme280_enabled: 0
 INFO | XDK DEVICE 1:  config.bme280_oversampling: 4
 INFO | XDK DEVICE 1:  config.bme280_filter_coefficient: 4
 INFO | XDK DEVICE 1:  config.bme280_sampling_rate_timer_ticks: 10
 INFO | XDK DEVICE 1:  
 INFO | XDK DEVICE 1:  config.max44009_enabled: 0
 INFO | XDK DEVICE 1:  config.max44009_integration_time: 50
 INFO | XDK DEVICE 1:  config.max44009_sampling_rate_timer_ticks: 10
 INFO | XDK DEVICE 1: 

I was wondering if you knew a work around this,

Eric

0 (0 Votes)
RE: Sd card sensor data
Answer
12/5/16 12:38 PM as a reply to Eric Zhong.

Hello Eric,

don’t worry, I am here to help. I suppose your issue is related a hidden directory placed by windows on your the SD card. These directories known as System Volume Information are the reason why the DataloggerDemo does not start logging. To solve this, you have to make sure the SD card is completely empty except the logger.ini file. To do so use the windows command line navigate to the the SD card and use dir /a to display all hidden files on the SD card. Then use rmdir "F: /System Volume Information" /s /q to remove the directory.

Note that F: is used as an example for the SD card directiory, you have to make sure that you use the correct path for your operating system.

Please tell me if this solves your issue.

Kind regards,
Franjo

0 (0 Votes)
RE: Sd card sensor data
Answer
12/5/16 9:50 PM as a reply to Franjo Stjepandic.

Hello Franjo,

I followed you directions and it works! Thank you so much it prints the data to my sd card now! 

Thank you so much for your help,

Eric Zhong

0 (0 Votes)
RE: Sd card sensor data
Answer
12/6/16 9:12 AM as a reply to Eric Zhong.

Hello Eric,

I am glad to help.

Please don't hesitate to ask if you have further questions.

Kind regards,
Franjo

0 (0 Votes)
RE: Sd card sensor data
Answer
8/29/17 7:52 AM as a reply to Franjo Stjepandic.

Hello together,

I get a assert in XDK_Datalogger_cc.c on line 172.

This is the section

if (SDCARD_DISK_INITIALIZED == SDC_diskInitStatus)
        {
            if (f_mount(&globalmnt, DEFAULT_LOGICAL_DRIVE, FORCE_MOUNT) != FR_OK)
            {
                assert(0);
            }
		}

I deleted all files on the SD-Card.

What tells me this assert?

Have someone a solution for this?

 

I just comment the code out.

Now I get this information:

Connecting to XDK device 'XDK Device 1' in port 'COM3'...
 INFO | Connection to port 'COM3' established
 INFO | XDK DEVICE 1:  config.bma280_enabled: 0
 INFO | XDK DEVICE 1:  config.bma280_bandwidth: 0
 INFO | XDK DEVICE 1:  config.bma280_range: 0
 INFO | XDK DEVICE 1:  config.bma280_sampling_rate_timer_ticks: 0
 INFO | XDK DEVICE 1:  
 INFO | XDK DEVICE 1:  config.bmg160_enabled: 0
 INFO | XDK DEVICE 1:  config.bmg160_bandwidth: 0
 INFO | XDK DEVICE 1:  config.bmg160_sampling_rate_timer_ticks: 0
 INFO | XDK DEVICE 1:  
 INFO | XDK DEVICE 1:  config.bmi160_enabled: 0
 INFO | XDK DEVICE 1:  config.bmi160_bandwidth_accel: 0
 INFO | XDK DEVICE 1:  config.bmi160_bandwidth_gyro: 0
 INFO | XDK DEVICE 1:  config.bmi160_range: 0
 INFO | XDK DEVICE 1:  config.bmi160_sampling_rate_timer_ticks: 0
 INFO | XDK DEVICE 1:  
 INFO | XDK DEVICE 1:  config.bmm150_enabled: 0
 INFO | XDK DEVICE 1:  config.bmm150_data_rate: 0
 INFO | XDK DEVICE 1:  config.bmm150_sampling_rate_timer_ticks: 0
 INFO | XDK DEVICE 1:  
 INFO | XDK DEVICE 1:  config.bme280_enabled: 0
 INFO | XDK DEVICE 1:  config.bme280_oversampling: 0
 INFO | XDK DEVICE 1:  config.bme280_filter_coefficient: 0
 INFO | XDK DEVICE 1:  config.bme280_sampling_rate_timer_ticks: 0
 INFO | XDK DEVICE 1:  
 INFO | XDK DEVICE 1:  config.max44009_enabled: 0
 INFO | XDK DEVICE 1:  config.max44009_integration_time: 0
 INFO | XDK DEVICE 1:  config.max44009_sampling_rate_timer_ticks: 0
 INFO | XDK DEVICE 1:  
 INFO | XDK DEVICE 1: bad filename in logger.ini

 

 

 

 

0 (0 Votes)
RE: Sd card sensor data
Answer
8/29/17 2:56 PM as a reply to Martin Scheck.

Hello Martin,

first I'd like to welcome you to the XDK community.

The assert tells you, that the function f_mount(...) was not successful. f_mount is used to register the content of the SD Card as a logical FAT File System. In simple terms, it makes the contents of the card available to the XDK. Since the return code is not FR_OK, the application stops, because the SD Card cannot be read or written to.

As such, I recommend to make sure that the SD card is properly chosen and formatted. To quote from the FAQ, regarding the SD card support:


XDK supports Micro SD cards up to version 2.0 of the SD specification (card capacity up to 32 GB) with FAT (File Allocation Table) filesystems. Note: SDXC is NOT supported! We recommend anything up from Class 4 performance wise.

If the SD card is in order, also make sure that the SD card is inserted into its slot in the XDK properly.

Kind regards,
Franjo

0 (0 Votes)
RE: Sd card sensor data
Answer
4/17/19 9:23 AM as a reply to Franjo Stjepandic.

Hi Franjo,

 

sorry to bother you at the thread which have been past a long time.

 

I have encountered with the same problem and I cannot download the demo you advised, here is the screenshot of the link you specified, so, could you show me how to download the DataloggerDemo or if you can send it to me directly will be much preferred.

 

thank you very much!

0 (0 Votes)