Home > other >  For help, stm32 serial port receive data
For help, stm32 serial port receive data

Time:11-20

Have passed to help, thank you
Serial port after receiving data on the serial port assistant print buffer data, but cannot be converted to json format data, printf cannot print the json data format

CodePudding user response:

After a serial port receives the data, their complete json format packaging, send out again

CodePudding user response:

reference 1st floor xws245925587 response:
, after a serial port receives the data to complete the json format package, then sent out

A great god can you give an example, I am a beginner, ability is limited

CodePudding user response:

See your screenshot, the data are not visible characters display directly, I guess because of data encoding format,
Server push big probability utf-8 data format, serial port tools most are gb2312 encoding format,
So you printf printed, it is not a json string
You set a serial port tool to hex, according to the hex data replication, baidu search tool for the text string to hexadecimal, these conversion tool many is utf-8, conversion come out and see if it is the json format string

CodePudding user response:

Use ASCII, or directly use hexadecimal, you this code code type too much, his confused, there are no problems with the bottom of the east

CodePudding user response:

Json must be your own packaging
  • Related