Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

usb msc problem writing with BLE lib.

Hello,
I have a custom board with nrf52 module, one memory, one accelerometer and one gyroscope (the memory is the same used in your ev. board PCA10056).

I combine the examble uart_peripherial and usb_msc.

My application have to read the data from the acc/gyro and store them into the memory as a text file....when you connect the device trought the usb port at the PC, the device switch and become a mass storge so the user can see the txt file with all the datas sampled.

Everithings works good.
I decide to add bluetooth so the user can choose when the device start sampling by sending them command string over BLE, but I have a problem.....

When I also add BLE function sometime in the text file there are ' ÿ ' chars and the file is corrupt.

The problem is the function "f_write()"

The file txt have to look like as follows:

3909,5,0,8,5,-12,14
3910,5,0,8,4,2,15
3911,5,0,8,5,-14,14
3912,5,0,8,6,-12,14
3913,5,0,8,7,-14,13
3914,5,0,8,5,13,-12
3915,5,0,8,6,13,1
3916,5,0,8,4,-13,15


But just when I add BLE routines the file is like this:

3917,5,0,8,6,-13,1
3918,5,0,8,5,13,1ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ,6,-13,-13
3932,5,0,8,4,3,13
3933,5,0,8,5,0,-15
3934,5,0,8,6,-11,2
3935,5,0,8,5,1,-14
3936,5,0,8,5,-3,0


when the sampling is very long, more the one hour, the file have problem and windows can not open it (the ripetation of the 'ÿ' char wrote corrumpt the file).
I also tried to disable the bluetooh using the functions "sd_ble_gap_adv_stop()" and "sd_ble_gap_disconnect()".
The error still occur.
How can I fix it, have you any idea?

Parents Reply Children
Related