Enabling 2:nd USART on RS nodes Revision -------- 0.3 2019-04-25 Background ---------- The AtMega128rfa1 and AtMegarf256r2 series shares uart1 pins with interrupts pin p0 and p1. So we have to chose function. The default function has been to use the interrups pins. In same applications the usart1 would rather be preferred. Experimental and the mod is on your own risk. With some HW & SW modifications it is possible to enable usart1. It needs skill for soldering/desoldering of SMD components. Hardware modifications ---------------------- * Front side mods Remove R301 (Pull-up for CON_INT5) See pict: --------- http://radio-sensors.com/pictures/usart1-mod-front.jpg * Back side mods Remove R776, R777, R778, R779 and U777 (This is the comparator unit) Make a patch between R776 (right pad) to the 2-pin header CON_COMP See pict: --------- http://radio-sensors.com/pictures/usart1-mod-back.jpg You now have usart1 on: RX1 on P0 (white cable seen on front pict) TX1 on P1 (grey cable seen on front pict) (black is GND seen on front pict) Desoldering tips ---------------- https://www.google.com/search?client=ubuntu&channel=fs&q=desolering+SM+resistors&ie=utf-8&oe=utf-8#kpvalbx=1 Software modifications ---------------------- This will be a part of the platform code. Now the support is via the commit below: https://github.com/posjodin/contiki in branch coap. commit 57f3d5dbfe4070b3e9f602fa586329ccbb5b6b90 Author: Robert Olsson Date: Sun Jan 27 22:13:22 2019 +0100 Support for USART1 avr-rss2 platform modified: platform/avr-rss2/contiki-conf.h modified: platform/avr-rss2/contiki-main.c modified: platform/avr-rss2/rss2.h The essential code: - rs232_init(RS232_PORT_0, RS232_BAUDRATE, USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8); - rs232_redirect_stdout(RS232_PORT_0); + rs232_init(RS232_PORT_0, USART0_CONF_BAUD_RATE, USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8); + /* UART1 Disables P0, P1 interrups pin and need HW fix for rss2 */ +#ifdef USART1_CONF_ENABLE + rs232_init(RS232_PORT_1, USART1_CONF_BAUD_RATE, USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8); +#endif + + rs232_redirect_stdout(SERIAL_LINE_CONF_UART); Configuration ------------- User defines: USART1_CONF_ENABLE to enable usart1 USART1_CONF_BAUD_RATE speed SERIAL_LINE_CONF_UART control Contiki console output usart0 or usart1 Example from project_conf.h . . #define USART1_CONF_ENABLE 1 #define USART1_CONF_BAUD_RATE USART_BAUD_38400 //#define SERIAL_LINE_CONF_UART 1