MicroPilot

MicroPilot Autopilot Users Group

Hi Micropilot team,

is it possible to establish an RS232 birectional communication channel where numerical values can transit? In Appendix B (Serial Ports & UARTs of the Autopilot's Manual) I read that UARTs are configurable to comply with many protocols, which can been found listed in VRS Editor's help. There I can see the one that seems the most corresponding to what I need: CSV (sends/receives comma separated values). But I cannot find anywhere how to actually implement this? Suppose I'm able to send a number via RS232, how can I store it in an autopilot's field (and vice versa)?

Thank you very much!

Mario, HELICAMPRO

Views: 208

Reply to This

Replies to This Discussion

Hello Mario,

The CSV protocol could be used for that. It will let you send fields from the autopilot out of a TPU line in comma delimited format, or receive comma delimited data and save it in fields.

If you want to pass this data bi-directionally from the GCS to a device connected to the autopilot you can use the COM Tunneling protocol instead. With that the autopilot will forward data from the virtual COM port on the GCS to the Tx TPU line on the autopilot, and data received on the Rx TPU line will be sent to the virtual COM port. The autopilot won't store or use the data.

For the CSV protocol in particular though, where the values are sent from or received to fields in the autopilot, here are details:

The CSV protocol is used to send or receive field data by CSV format to the autopilot.

The CSV protocol will send or receive a comma separated value string of numbers (32 bit in size) and read/place the values in protocol or scratch fields.

FIELD NUMBER EXAMPLES IN THIS DESCRIPTION ARE FOR UART1!

How many fields will it fill?
45 fields maximum
From xx00 to xx44 (scratch or protocol) + 2 more fields (xx45 + xx46) to set the # to send and to trigger it to send.


It is up to the system designer how he/she uses these values in the fields.

The autopilot does not do anything with the values in these fields. It will receive and populate them, or send the values in them when triggered.
Any autopilot reaction to these fields needs to be written by the user with XTENDER or fly file commands.

Instructions:
CSV protocol is used to send a sequence of values to or from the autopilot.  You configure an Autopilot UART to communicate by CSV protocol. Select either scratch or protocol fields in the UART setup.

Receiving:
The CSV protocol will receive a  string of values - up to 45 of them - 32 bit in size - separated by commas, and place the values in certain Autopilot fields; either protocol fields or scratch fields may be selected.

Protocol CSV fields are #2600 to 2644 (for UART 1)
Scratch CSV fields are #1545 to 1589


Sending:

To send data, you populate the fields (as many as you need, up to #45) .

The second last field (protocol: 2645 / scratch: 1590) needs to be set to the number of data items/fields that you want to send. They will be sent sequentially from the first field and up.

Then write to the 46th field:
(Protocol field = 2646)
(Scratch field  =  1591)

The CSV protocol checks this field at 30Hz and it will send the data in the CSV fields over the UART when this field is non-zero. The string is sent once and then the field is reset to 0 after the data is sent.

If you write 1 in that field, the autopilot converts the field values to their C-string representation, comma separated.

If you write 2 in that field, the autopilot sends the fields in their natural (raw) representation, "little endian" (i.e. smallest byte first); no commas are used to separate them because they're fixed-width values in that representation.


The values received in, or sent from, these fields are not recognised by the Autopilot.  It is up to the user to handle the data either in a .fly file or in an mp plug-in.  For example, signed 32 bit integers are the storage/transmission type of these fields but because they are in contiguous memory you can write an mp plug-in that does whatever you want with the values in those fields.


Example output (first 4 fields set to 1 2 3 and 4 respectively). End of lines contain CRLF newline character:
1,2,3,4                                                                      
1,2,3,4                                                                     
1,2,3,4


Example thread to update 3 fields with data and send them continuously:
thread 1
[1590] = 4
[1545] = [1054]
[1546] = [1053]
[1547] = [1095]
[1548] = [1096]
[1591] = 1
repeat -5

Output from the above thread:
-10,0,-848884530,436943538
-10,0,-848884530,436943536
-10,0,-848884530,436943536
-10,0,-848884530,436943536
-10,0,-848884530,436943536

Evan Schellenberg

MicroPilot Support

RSS

Share

© 2024   Created by MicroPilotNingAdmin.   Powered by

Report an Issue  |  Terms of Service