AnsweredAssumed Answered

Configuring UART in Linux on iMX6

Question asked by Daniel Laks on Dec 21, 2016
Latest reply on Dec 22, 2016 by Daniel Laks

I'm getting confused how to interface with the peripherals on the iMX6 in Linux. I'm very familiar with directly accessing hardware registers in the context of a microcontroller, but I don't understand how that translates in the Linux user environment.

 

I have a Gateworks GW5510 board that comes with a Yocto Linux build on it from the manufacturer. I did not have to create my own Linux build nor do I have any experience creating Linux builds for embedded systems. I want to interface the board with an external device that speaks logic-level serial, but in a slightly uncommon configuration: inverted 8E2 (8 bits, even parity, 2 stop bits). I read the UART section of the reference manual for the iMX6 and found all of the register bits I need to change to set up the serial port appropriately.

 

What is the typical way to adjust the registers on a UART? Is that usually done when creating the Linux build and not in the user space? I discovered the devmem2 tool that allowed me to directly access and modify the registers by physical memory address, but that seems clunky and dangerous.

 

I found imx.c in the Gateworks git repository, which I believe is the serial uart driver. But I don't understand the context of how that driver is applicable. Is that driver just "behind the scenes" stuff or do I need to use it in my own code to access the serial port?

 

My end goal is to be able to write a program in c++ (cross-compiled on my desktop PC) that will allow me to read the serial port on the Gateworks board.

Outcomes