• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomepcDuinoArduino-ish ProgramUARTpcDuino : Extends to 4 UARTs
Previous Next

pcDuino : Extends to 4 UARTs

Posted by: admin , August 13, 2014

The original post is from:  http://jbvsblog.blogspot.com/2013/09/pcduino-extends-to-4-uarts.html

 

*updated : spi0 deactivation in fex file

Usually when you want to use UARTs on pcduino standard configuration , you can use the serial debug (Debug port), and the UART available on gpio pins, close to the micro sd card.

 

pcduino_config

For my next project I need to use several cards/modules that uses serial communication (GPS, IMU), and I need some other serial ports. I decided to find a way to activate 1 or 2  more serial ports, as the A10 Allwinner SOC have 8 UARTs.

IMG_0957

 

PcDuino + Debug Port + IMU connected on UART1
  • A10 Pcduino Schema

 

 

IMG_0955

 

A10 connection to the board
I first started to examine the pcduino board schema, to see if available pins on the board and A10, could be connected to one of the 8 uarts. I eliminated several of them excepted UART5 and UART6. They are connected to SPI0 interface, and can be available on J8 and J7 connectors.

You can get the board schema here.

If we add this ports, we will have 3 usable ports for the user, and one for debugging.
IMG_0960
UART5-6 can replace SPI0
  •  Fex configuration
To build my project, I have compiled the last sunxi kernel, and added my own debian configuration.  At startup, the sunxi kernel loads a configuration file, script.bin. It is in fact a compilation of readable configuration, written against each board that contains A10 Soc. You can find how to build your own kernel with the instruction you will find here.

All configurations are written in  .fex files in sunxi-board project.
To know how to write these fex configuration see the Fex Guide .
For uart ports , the definition looks like this :

[uart_para0]
uart_used = 1
uart_port = 0
uart_type = 2
uart_tx = port:PB22<2><1><default><default>
uart_rx = port:PB23<2><1><default><default>

This defines the UART0 configuration, with TX pin for PB22 soc pin and RX pin for PB23 soc pin. This corresponds to the pcduino schema.

  • Port definition
In the Fex Guide you have a description on how to configure ports (pin connexions) for each device, and for our problem, we need to define UARTs ports , see .

A port is configured like this:

port:<port><mux feature><pullup/down><drive capability><output level>

port => pin description (i.e PB22)
mux feature => (important see above)

  • IO Configuration

After a first test I had some issues with “serial8250: too much work for irq#”.
I finally found the bug, this was the second configuration port parameter : each pin have a multiplexer that activate a device redirection. In our case, we want the pin to be connected to UARTs :

PortBank

You have all information here.

  • Final .fex configuration

I have configured files with the configuration above :

[spi0_para]
spi_used = 0
spi_cs_bitmap = 1
spi_cs0 = port:PI10<2><default><default><default
>spi_sclk = port:PI11<2><default><default><default
>spi_mosi = port:PI12<2><default><default><default
>spi_miso = port:PI13<2><default><default><default>

[uart_para5]
uart_used = 1
uart_port = 5
uart_type = 2
uart_tx = port:PI10<3><1><default><default>
uart_rx = port:PI11<3><1><default><default>

[uart_para6]
uart_used = 1
uart_port = 6
uart_type = 2
uart_tx = port:PI12<3><1><default><default>
uart_rx = port:PI13<3><1><default><default>

I have rebuild my script.bin and copied it in the boot partition, near the kernel.

Fex_Configuration

 

  • Testing

First action is to restart  the pcduino with the new configuration, you can validate that UARTs are correclty started by typing in a terminal :

dmesg | grep uart

You will see something like that :

 

dmesg

 

 

‘m testing with an IMU card the serial connection (9DOF IMU). I have build my own serial program you can get source code here.

IMG_0966

 

 

Connection on J8 connector to test UART5

 

 

 

IMG_0965

 

Testing configuration

 

 

 

Tags: UART

Share!
Tweet

admin

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors