Page 1 of 1

Reusing uart.c functions for a serial device

Posted: Mon Jul 24, 2017 12:41 am
by dbc
I'm working on a project with a couple of serial protocols that need to run relatively fast. I'm thinking of creating C modules that implement the protocols so that the Python interface doesn't have to keep up with the character-level protocols. Can I link against uart.c to pick up the basic uart initialization and character I/O? I'd rather not rewrite all of that stuff. Also, I thought at one point the uarts were DMA-enabled, it would be great to be able to re-use that. Any pointers?

Re: Reusing uart.c functions for a serial device

Posted: Mon Oct 09, 2017 9:19 am
by ajie_dirgantara
dbc wrote:I'm working on a project with a couple of serial protocols that need to run relatively fast. I'm thinking of creating C modules that implement the protocols so that the Python interface doesn't have to keep up with the character-level protocols. Can I link against uart.c to pick up the basic uart initialization and character I/O? I'd rather not rewrite all of that stuff. Also, I thought at one point the uarts were DMA-enabled, it would be great to be able to re-use that. Any pointers?
How fast does it needs? as far as I know micropython execution time is still capable to handle relatively fast baudrate (e.g. 115200). And if you need raw processing power in C, you could implement your own protocol in C, called in python after the data stream is received, without touching uart.c Leave uart.c as it is and make your serial buffer large enough so it could processed faster.

Re: Reusing uart.c functions for a serial device

Posted: Wed Dec 30, 2020 8:02 pm
by garya@arcimoto.com
Hi,
Has anyone done this before? I'm wanting to access a serial device connected to my MCU and would like to reuse the C source code library I have that communicates over a UART interface.
Here is my high-level design
micropython <-> micropy_interface <-> existing C library <-> C-based uart interface <-> hardware.

I'd rather not port the C library over to micropython just because it's all working and tested on a Windows OS. Maintaining two code repos and syncing them can be a burden.

Thanks much for any help, it is greatly appreciated.

Re: Reusing uart.c functions for a serial device

Posted: Mon Jan 11, 2021 12:21 am
by jimmo
garya@arcimoto.com wrote:
Wed Dec 30, 2020 8:02 pm
Has anyone done this before?
We use this for the BLE HCI driver on STM32.

Which port are you using?