Monday, November 9, 2015

Phase 2: RS-232 blues continued ...

To make debugging with the scope easier ... I modified the code to toggle a pin high before writing to the uart, so I can use it as an external trigger for scope channel A.

while(1)
        {
        //wdTemp++;
        //uartio_printf("%d\r", wdTemp);

        (LPC_GPIO1->SET) = (1 << wdGpio); 
        //timer_delay_mS(1);
        uartio_putc(0x30);
        (LPC_GPIO1->CLR) = (1 << wdGpio);  
        //timer_delay_mS(1);
        }
 
Was able to verify UART TTL output on the TX line and later the level converted value out of the MAX232. But there were problems with the db9 connector so I set that aside to test out connector K1 the second serial port (uart0) (db9 was uart1) and the ttl-to-uart adapter pictured below







But I discovered problems with its MAX232 part and had it replaced, then I got the expected output. The pin out of a DB9 viewed from left to right is (female)  x = dont care
1. x
2. RX
3. TX
4. x
5. GND

ON this part I detected output on pin 2 which meanth it had a NULL modem wiring (RX-to-TX) so I needed a straight feed through serial cable between it and my development PC' serial port.




The ascii code above represents the value 0x30 or '0' (decimal 0). The length of the character transmission (on the scope) is ~70uS (3.5 bars at 20uS). That means ~14,285 characters are transmitted a second.

Makes sense since 115200/8 bits = 14,400 and I was eyeballing the above values.

On the scope everything looks fine for uart-TTL and uart-RS232. But I see gibberish under minicom and the uart line status register on the lpc1778 reports framing errors (missing stop/start bits?)

`�H `�H �

I even switched the baud rate down to 9600 to the same results.
Ill start looking at cabling later this week. I already tested one set of cables with an stm32 devel board I had lying around ... and it was fine.

Note to self:
here is a method for reading raw values out of the serial port
stty raw
cat >/tmp/received.dat </dev/ttyS0  
(i wonder what setting it inherits for baudrate)
hexdump -n 256 /tmp/received.dat
stty normal or stty sane
returns the terminal emulator to its sane setting

No comments:

Post a Comment