Just tested, I didn't use minicom 'cause it's not installed on the Linux distro I used for testing and I don't want to search for a long enough ethernet cable but echo and cat works both ways so the cable and the configuration on the other side is perfectvvaltchev wrote:Just pick up an old Linux and try a two-way communication using minicom.
Exactly, QEMU works perfectly.vvaltchev wrote:In my understanding, his code already works on QEMU. The problem is only with real hardware.nexos wrote:Anyway, @Bonfra, try testing the serial code in QEMU and see if anything gets sent to the serial monitor.
The problem must be in the initialization code, this one:
Code: Select all
#define PORT 0x3f8 // COM1
static int init_serial() {
outb(PORT + 1, 0x00); // Disable all interrupts
outb(PORT + 3, 0x80); // Enable DLAB (set baud rate divisor)
outb(PORT + 0, 0x03); // Set divisor to 3 (lo byte) 38400 baud
outb(PORT + 1, 0x00); // (hi byte)
outb(PORT + 3, 0x03); // 8 bits, no parity, one stop bit
outb(PORT + 2, 0xC7); // Enable FIFO, clear them, with 14-byte threshold
outb(PORT + 4, 0x0B); // IRQs enabled, RTS/DSR set
outb(PORT + 4, 0x1E); // Set in loopback mode, test the serial chip
outb(PORT + 0, 0xAE); // Test serial chip (send byte 0xAE and check if serial returns same byte)
// Check if serial is faulty (i.e: not same byte as sent)
if(inb(PORT + 0) != 0xAE) {
return 1; // <---- here it returns error
}
// If serial is not faulty set it in normal operation mode
// (not-loopback with IRQs enabled and OUT#1 and OUT#2 bits enabled)
outb(PORT + 4, 0x0F);
return 0;
}