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.
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.
PcDuino + Debug Port + IMU connected on UART1 |
- A10 Pcduino Schema
A10 connection to the board |
You can get the board schema here.
UART5-6 can replace SPI0 |
- Fex configuration
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
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 :
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.
- 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 :
‘m testing with an IMU card the serial connection (9DOF IMU). I have build my own serial program you can get source code here.
Connection on J8 connector to test UART5
Testing configuration
Leave a Reply
You must be logged in to post a comment.