Receive RX data & save SDCard
응답
18. 2. 19 오후 1:01

Hello,

I want to test receive RX data and save it on SDCard(.txt)

So At the ExtensionBus example code, I add the write file part.

However, I couldn't print out the RX data and save strange data on txt file.

1) Is it possible to save data on txt file? How can I change?

2) I couldn't print the RX data on Console. How can I change?

0 (0 투표)
RE: Receive RX data & save SDCard
응답
18. 2. 19 오후 3:49 as a reply to Choi Goeun.

Hello Choi, and welcome to the community, let me ask you:

- Did you initilize the file system by calling the mount function? The mount of

file system is called once, but it mandatory otherwise the further actions will

not work correctly, take a look on FS XDK API:

http://xdk.bosch-connectivity.com/xdk_docs/html/group__filesystem.html



- I found a quite strange line on image 1, you have data as uint8_t type which de-reference the process pointer and you pass data address through commandProcessorEnqueue, keep in mind data is destroyed after  the processData function exits which will corrupt the data sent by enqueue, the commandProcessor pass data by reference and not by copy such FreeRTOS standard queue.

My first tip, pass the contents of process directly to enqueue command, this will avoid to corrupt data.

If you have such problems, please let me know>

Felipe

 

0 (0 투표)
RE: Receive RX data & save SDCard
응답
18. 2. 19 오후 4:20 as a reply to Felipe Neves.
Hello Choi

regarding the print statement in the first image, does nothing get printed to the console at all, or does it print the wrong data?

Have you tried checking whether anything is printed at all? This would help determining if the XDK is getting an RX signal or not. For that, simply print something like printf("test\n\r") inside processdata1() .

As for storing data on the SD card, how did you embed this functionality into your application? Could you give me some hints on what data you are storing, and where/when you do it? Your screenshots do not give much of a hint in that regard.

Of course, as Felipe mentioned, mounting and initialization should be done correctly. There is a guide on SD Cards in the Learning Section and an SdCardExample in the Workbench's Welcome-Screen.

Additionally, have you checked whether the text in your text-file is shown using the correct encoding? The fact that you are being shown CJK characters, which usually implies the use of an encoding that reads two bytes (or more) as one character. The characters should instead be interpreted in UTF-8 format, i.e. interpreting one byte as one character.

Finally, as Felipe correctly pointed out, the variable data will probably corrupt the data, since data will be released, once the fuction processData1 is finished. As suggested, directly insert the variable process instead of &data in the enqueuing function.

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Franjo
0 (0 투표)
RE: Receive RX data & save SDCard
응답
18. 2. 20 오전 6:46 as a reply to Franjo Stjepandic.

Thank you for replying.

I added printf("test\n\r") the processdata1() function.

However I couldn't see the console.

 

I want to mix ExtensionBusUART exapmle and SdCardExample.

So I send the HEX code(ex 33) to XDK, and save the HEX data at the SDcard. However After mixing the code, I couldnt the HEX code(RX)data on Console as well as SDcard txt file.

I change the UTF-8 format txt file. However it is failed.

0 (0 투표)
RE: Receive RX data & save SDCard
응답
18. 2. 20 오후 4:21 as a reply to Choi Goeun.
Hello Choi,

I assume that, since the function processdata1() is not being called at all (indicated by the fact that the string is not being printed), there may be an issue with how you merged the two examples.

Could you show me the contents of your makefile, the project structure of your application in the Project Explorer and the content of appInitSystem() ? I would prefer these as screenshots.

What I suspect is that the appInitSystem() is not correct and that you are initalizing only the code from the SdCardExample, and not from the ExtensionBusUART example.

Regarding the text file, could you go into more detail how and why changing the format failed? Did it still not present the correct string inside the fail, or did changing not even take place?

Kind regards,
Franjo
0 (0 투표)