# Writing a Custom UART Driver

Source: https://forum.modalai.com/topic/2922/writing-a-custom-uart-driver
Category: VOXL SDK and Software (https://forum.modalai.com/category/47/voxl-sdk-and-software)
Tags: voxl-sdk
Posted: 2023-12-05 15:48:41 UTC by LucaVertiq
Replies: 6 · Views: 2345

## LucaVertiq · 2023-12-05 15:48:41 UTC

@Moderator Hi, our team is going to be writing a driver for UART control of vertiq motors for PX4 soon. Additionally I'm prototyping with a VOXL 2 Mini and have got the tool chain running. I know the voxl 2 works a bit differently than a standard px4 stm32 board. I was looking at the modalIO and I notice it is enabled in both voxl2-slpi and voxl2 default.px4board files. Is the slpi folder for the DSP half of the chip? Is it just a completely different board that I should ignore?

Thanks,

Luca

## Reply by Moderator (ModalAI staff) · 2023-12-05 16:27:39 UTC

@LucaVertiq you will need your uart driver to run in the slpi portion of the build. you should be able to find everything you need here: https://docs.modalai.com/voxl-px4/

## Reply by LucaVertiq · 2023-12-05 16:41:04 UTC (in reply to Moderator)

@Moderator Thanks, that's where I've been looking. I'll have to look harder at the slpi portion of the build to understand it better. If I have more questions I'll be back. Thanks!

## Reply by Eric Katzfey (ModalAI staff) · 2023-12-05 17:03:27 UTC (in reply to LucaVertiq)

@LucaVertiq Yes, you have a choice of where to put the driver depending on what UART port you are planning to use. If you use a UART available to the applications processor then you would use the standard voxl2 build. If you use a DSP UART then you would use the voxl2-slpi build.

## Reply by LucaVertiq · 2023-12-05 17:23:47 UTC (in reply to Eric Katzfey)

@Eric-Katzfey Ahh that makes sense. I see in the voxl 2 mini datasheet that it says apps or slpi proc for each uart. That's great.

So on the slpi proc how do I know what uart number to use in PX4. It looks like in the spektrum driver is selects uart 7 and the modal_io driver selects uart 2 which seems to match QUP7 and QUP2 in the datasheet:
![01cd2787-0445-4c8e-a7eb-37eafca4cfcc-image.png](https://forum.modalai.com/assets/uploads/files/1701796911826-01cd2787-0445-4c8e-a7eb-37eafca4cfcc-image.png) 

Am I understanding that correctly so far?

## Reply by Eric Katzfey (ModalAI staff) · 2023-12-06 16:13:17 UTC (in reply to LucaVertiq)

@LucaVertiq Yep, that is correct.

## Reply by LucaVertiq · 2024-02-02 17:46:59 UTC (in reply to Eric Katzfey)

@Eric-Katzfey Thanks to you we now have our motors running right off the SLPI processor with PX4 as a UART 'bus'. Everything seems to work great. The main issue was figuring out what qshell commands to send to start it up properly.
