Adding header and terminator to PX4 serial receive block

Hi,
I want to send data with header and terminator to Pixhawk board over radio telemetry. In the current version, PX4 serial receive block doesn't accept header and terminator, so i don't receive data on the Pixhawk 4 properly.
How can get the PX4 serial receive block to accept header and terminator?

1 Comment

Ali,
Were you ever able to receive the data on the Pixhawk successfully?

Sign in to comment.

Answers (1)

PX4 Serial read and write blocks enables basic data write and read through Pixhwak serial interface. Although, the header and terminator is not supported out of the box, you can always model the header or terminator logic around these blocks. Have a look at this example, which implement a header logic with the PX4 serial blocks.

4 Comments

Thanks for your answer Arun,
I took a look at this example before. You're right, we can model header/terminator when we want to send signal from Pixhawk to the host computer. But, if we want to send from host computer to Pixwak, there should be a serila receive block on the Pixhawk model to find the header/terminator. For example, we want PX4 Serial receive block be similar to Serial receive, which can accept header/terminator. I can get access to these blocks source code and try to modifiy it accordignly. But, it takes a while to do that. I was wondering if there is an easy way to do it. Maybe, Mathwork can do that and add it to the library.
Thanks for the clarification. In that case may be you can consider using, Protocol Decoder block with PX4 Serial receive block. In this block you have the option to specify the header and terminator. Currently It ships with Arduino Support package and you need to install Arduino support package to use the block. Its a generic block so you can use it with PX4 as well.
Thanks Arun,
I installed both "Simulink Support Package for Arduino Hardware" and "Embedded Coder Support Package for Texas Instruments C2000 Processors" which should have the Protocol Decoder block. After i installed them, i couldn't find that block in my simulink library. It's strange!
This block is only available from R2021b. Are you using any older release? As per the documentation it should be avaialable in the ' Common' library under Simulink Support Package for Arduino Hardware. Also check if it is coming up when you search for it in the Simulink canvas.

Sign in to comment.

Products

Release

R2021a

Asked:

on 3 Dec 2021

Commented:

on 29 Sep 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!