Search code examples
linuxdriveruart

Access USART from kernel to send and recive


Hy i wanted to Use the USART3 from my STM32MP157-DK1 Module. i wanted to write a simple driver witch listens on the RX and writes it as Kernel Log and the TX to send an a every send. To my question whats the common whay to access the uart. What i have tried was to add the USART in the device tree so the tty driver makes it usable. But i wanted to read and write then ofer the dev/tty* file and what i know it is not recomended to open files from Kernel Space. Can someone tell me how the common way is. An example would also be helpfull. Sorry for the question but i am new in this area.


Solution

  • In my case i looked it up how the TTY Driver from the System does it and i do it now like this way (drivers/tty/serial/stm32-usart.c). I also found out i could use the secend CPU and share the invormations with Interrupts.

    The example code can be found here: stm32.usart.c