Hello all, I'm new to seL4 and embedded systems, please bear with me. I'm trying to use Sabrelite's UART1 (PS_SERIAL0), while I can make it write data (putchar), I can't make it read (getchar).
The code is as follows on sel4 7.0.0, using platsupport/sel4platsupport:
ps_io_ops_t io_ops;
error = sel4platsupport_new_io_ops(vspace, vka, &io_ops);
printf("Initialising io_ops: %d\n",error);
ps_chardevice_t serial0;
ps_cdev_init(PS_SERIAL0,&io_ops,&serial0)
ps_chardevice_t serial1;
ps_cdev_init(PS_SERIAL1,&io_ops,&serial1); //CONSOLE
int character;
while (1) {
character = ps_cdev_getchar(&serial0);
//printf("%d\n",character);
if (character != -1) {
ps_cdev_putchar(&serial1,character);
printf("%d\n",character);
}
}
This runs fine on QEMU with -serial file/ttyUSB -serial mon:stdio. Next I tried to run this on the Sabrelite board:
-Apply patches 1 and 2 (applying 3 and 4 caused uboot to stall)
-Put uboot into SPI flash
-Restart, run the sel4 image on the SD card, with UART2 connected to PC's RS232 and displayed by minicom, and UART1 connected to /dev/ttyUSB0
-Have a python script writing 'A's to /dev/ttyUSB0
sel4 loads but fails to read anything from /dev/ttyUSB0, UART1 just receives EOFs (-1s). The rxd seems to always be 0. Swapping the UARTs works, at the cost of losing the console:
while (1) {
character = ps_cdev_getchar(&serial1);
//printf("%d\n",character);
if (character != -1) {
ps_cdev_putchar(&serial0,character);
printf("%d\n",character);
}
}
So UART2 (default console) can read and write, while UART1 can write but not read. Has anyone encountered the same problem? Suggestions much appreciated.
Regards,
Leow Wei Xiang