QN908xcdk read file and Bluetooth communication

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

QN908xcdk read file and Bluetooth communication

2,230 Views
mjkimbravo
Contributor III

Hello,

I try to do data transmission through QN9080cdk using SDK example in MCUxpresso: "qn908xcdk_wireless_examples_bluetooth_private_profile_server_bm". I works fine, and USB dongle get data well. Now I want to change the sending data to in my PC file.

 

Default in SDK: tx_data[]

mjkimbravo_0-1716624614249.png

 

Now I want to read ".txt" or ".csv" file in my PC and send it wirelessly. So, I try to use fscanf() function in <stdio.h> or <stdlib.h>but it does not work. (of course I #include .h file)

mjkimbravo_1-1716624814670.png

 

The error message is below...

mjkimbravo_2-1716624856311.png

mjkimbravo_3-1716624898398.png

 

I check that fopen() and fclose() works fine, only fscanf() makes that problem. Almost similar function like fgets(), fprintf(), fputs(), etc... are all not working. What is the problem? Is it really a semihosting problem? How can I solve this problem or is there any other way to read or write files in my PC through MCUxpresso and send it wirelessly?

 

p.s. I have already read below NXP community questions similar with mine, but those are not helpful in my case.

 

 

Thanks, 

 

Labels (1)
0 Kudos
Reply
7 Replies

2,182 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @mjkimbravo 

Can you please let me know your SDK version and your MCUXpresso IDE version?

Do you mean when you build with the code you are showing in screenshot, it will show these errors?

I also tried on my side with IDE 11.9.0 and SDK_2_2_9_QN908XCDK, it can build successfully.

Christine_Li_0-1716802921305.png

 

Can you please with same SDK and IDE with mine and let me know your results?

 

Best regards,

Christine.

 

Tags (1)
0 Kudos
Reply

2,177 Views
mjkimbravo
Contributor III

Thank you your kindness.

My one is MCUXpressoIDE_11.9.0_2144 and SDK_2_2_9_QN908XCDK which is same as you.

Of course building is done well in my IDE. But if I actually want to send it wirelessly, I have to debug it. And when directly after connectivity QTool or loT toolbox actually starts receiving the data, the error happens.

The similar error also happens when I try to use fprintf() or fscanf() in any other SDKs and debugging it.. This is a post which I also uploaded in the NXP community for similar errors.

Cannot use fprintf in MCUxpresso SDK

 

 

Best regards,

0 Kudos
Reply

2,156 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @mjkimbravo 

Thanks for your reply.

I am trying to reproduce on my side.

Yes, you are right, the default example is working well.

And after I add the part you shared, I can compile successfully, flash successfully, but when it trying to connect with client, the client terminal will show disconnected automatically in several seconds like below:

Christine_Li_0-1716977907457.png

And also in my MCUXpresso, show same with you.

Christine_Li_1-1716978476428.png

I am trying to find the root cause and trying to resolve this issue.

 

Best regards,

Christine.

 

Tags (1)
0 Kudos
Reply

2,140 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @mjkimbravo 

I think the reason is because you are trying to open and read a file which is located in your Windows PC, not on the QN9080 board.

So it can not find this file on QN9080 board, and show this error.

Best regards,

Christine.

Tags (1)
0 Kudos
Reply

1,880 Views
mjkimbravo
Contributor III

Hello,

I think that's not a main issue, because fopen() and fclose() works well. If I don't write anything in .txt file and just open and close the file, the code generates .txt file well in my SDK folder on my Window PC. However, if I try to write something, error happens. Would you please help to solve this problem? The library is Redlib(semihost).

mjkimbravo_0-1721387069525.png

 

Thanks,

0 Kudos
Reply

2,129 Views
mjkimbravo
Contributor III

Thank you for your help.

Then, is there any other way to write & read file(.csv, .txt, etc) on my Window PC through QN9080 board?

For example,

  • Save the memory of file on PC in QN9080
  • Create a buffer or root to access PC data from QN9080
  • Find a SDK which make it possible to access PC
  • By using other programs like Python or Java, make accessible routes from the QN9080 to PC

 

Best regards, 

0 Kudos
Reply

2,119 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @mjkimbravo 

I suggest you to check Over the Air Programming (OTAP) examples which create an OTAP image file using the provided executable .srec or .bin file, connects to the embedded OTAP Server via the
configured serial interface and waits for commands. The application shows details about the creation of the image file and allows the configuration of the OTAP upgrade image file header.
 

For details, you can import the example and also check the Section: 5.20 Over the Air Programming (OTAP)  in Bluetooth Low Energy Demo Applications User Guide.pdf which is located in SDK_2_2_9_QN908XCDK\docs\wireless\Bluetooth\.

Hope my answer can help you somehow.

Best regards,

Christine.

 

Tags (1)
0 Kudos
Reply