Parameters Request over UART #36
Replies: 1 comment 1 reply
-
|
Hi, I understand the applications of this approach. However (if I understand correctly), this would require users to do some significant changes in their MCU code to work with Serial Studio. For complex projects, or less-powerful MCUs, you can write a JSON file on your computer and load the JSON in Serial Studio. This eliminates the need for the MCU to generate JSON frames and simplifies development (for example, the person who develops MCU code does not have to know anything about JSON). Here is an example JSON file that can be loaded into Serial Studio. I also have created an example project for Arduino. The project sends ADC readings through Serial, and you can freely modify the JSON file without the need of re-programming the Arduino. Also, there are some usage applications in which sending data to the MCU is not permitted (for example, most CanSat competitions). I think that letting users "describe" the order, format & meaning of the incoming data in a JSON (or "project") file is more useful and straightforward for everyone. Also, we can work on implementing more features by changing the format of the JSON file, examples include:
In other words, the JSON file can be as complicated, detailed and large as needed if its loaded from the computer that runs Serial Studio, while the MCU code does not even have to generate any type of JSON string. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
JSON is a bit of a heavy overhead for small microcontrollers, as well as having a huge impact on SPS over uart, yet offers no real advantage over simpler methods. However it would still be nice if the microcontroller could specify the desired application configuration on the PC, or that they can somehow negotiate what and how to display the data.
Proposed would be a simple query request issued from Serial Studio. The micro controller would respond with a CSV list describing the data without the overhead of JSON. Something like:
1, Sys_Voltage, V, 0.0, 5.0, G=true
2, Current, mA, 50, 800,G=true
3, Output_Voltage, V,,G=false
END
Where fields: 1 = csv position, 2= name, 3= units label, 4= min, 5=max, and 6=optional parameters. When min or max is null, then assume auto scaling
This request would be issued on demand but not impart any overhead on the micro otherwise. It would even allow to easily change com port settings to another device and automatically requesting a new display layout.
By starting each line with a csv position, the data could be sent out of order (I dont see why you would want to, but it makes it irrelevant). In the future it would permit to have the same data displayed using multiple widgets, such as line plot and needle gauge.
Beta Was this translation helpful? Give feedback.
All reactions