Smart-Pin asynchronous transmission logic level
JonTitus
Posts: 193
in Propeller 2
When I run the attached test code the bits appear properly on my scope but the initial state of the Smart-Pin transmitter pin appears as a logic-0. After the first transmission, this pin remains a logic-1 between transmissions. Based on experience with UARTs, the output should start at logic-1 so the receiving device "sees" the logic-1 to logic-0 edge of the start bit. How can I get the output pin to start as a logic-1? Thanks. --Jon
'Async Transmit Ver 2, 6-10-2020 at 1528H MDT 'Thanks to Ray Rodrick, et al. CON ' Constants for serial-port control _rxpin = 21 ' P21, serial in _txpin = 20 ' P20 serial out '_baud = 115_200 ' not used _bitper = $3640_0007 ' bit rate for tests _txmode = %0000_0000_000_0000000000000_01_11110_0 'async tx mode, output enabled for smart output DAT wrpin ##_txmode, #_txpin ' set Smart-Pin asynchronous transmit mode wxpin ##_bitper, #_txpin ' set transmit bit period for 8 bits of data dirh #_txpin ' enable smart pin tx nop wypin #$55, #_txpin ' transmit test bit pattern 01010101 nop .flag_test testp #_txpin wc ' wait for transmit buffer empty if_nc jmp #.flag_test ' if not empty, test again waitx ##25_000_000 / 70 ' delay inserted for testing wypin #$99, #_txpin ' send testing byte to tx pin jmp #.flag_test ' transmit "forever"
Comments
If you are ok with a floating pin during reset, you can pgm an internal pullup before the pin is used as TXD.
This code configures P54 as serial transmit. The moment WYPIN which is equivalent to the PASM WRPIN is executed, then P54 switches from a floating input and becomes a high output.
Normally in TAQOZ the pin would be configured at a higher level like this: which sets the baud rate and 8-bit data by default and also writes a null character to prime the ready signal.
EDIT: Just to confirm exactly when the pin goes high, I added a test pulse around WYPIN and scoped it. Trace 1 = P54=TX
Trace 2 = P55 test pulse