Shop OBEX P1 Docs P2 Docs Learn Events
FullDuplexSerial perplexed — Parallax Forums

FullDuplexSerial perplexed

steprogsteprog Posts: 227
edited 2010-11-01 22:14 in Propeller 1
Hi Guys,
I got an issue with the fullduplexserial object. I set up 3 uarts. One for going to the terminal, one for simulating data being sent to me, and one that communicates to some other equipment.

With 3 uarts and 3 different lines being used, I figured this would work, however my transmission goes out the same uart not three.

Here is the code Ignore the comments, I had to put them in to get my integration to work. Please forgive any sloppyness, really in a hurry.
Any ideas would be appreciated.


debug.start(pcDebugRX,pcDebugTX,Mode,pcDebugBaud) ' start the PC debug object
uart1.start(RX1,TX1,Mode, pcDebugBaud)
uart2.start(RX2,TX2,Mode, pcDebugBaud)
debug.rxflush
uart1.rxflush
uart2.rxflush

' Test Only
Checksum:=$24
ComByte:= $22

uart1.tx(Sync[0])
uart1.tx(Sync[1])
uart1.tx(Checksum)
uart1.tx(ComByte)
waitcnt(clkfreq*3 + cnt) ' wait for PC to reply

comtest:= uart2.rx
comtest2:= uart2.rx
'' debug.tx(13)
' display(string("Received"))
' debug.hex(comtest,2)
' debug.hex(comtest2,2)
' debug.tx(13)



if comtest == $CA and comtest2 == $35
' display(string("Good Sync "))
Checksum:= uart2.rx
ComByte:= uart2.rx
' debug.hex(Checksum,2)
' debug.str (@space)
' debug.hex(ComByte,2)
' debug.tx(13)
DoCheckSum
If DoCheckSum
ParcCommand
else
Error[1]:=$01
ParcCommand
CreateCheckSum
SendStatus
else
uart2.rxflush

PRI SendStatus
debug.tx(Sync[0])
debug.tx(Sync[1])
debug.tx(CheckSum)
debug.tx(ComByte)
debug.tx(Error[0])
debug.tx(Error[1])
debug.tx(Therm1[0])
debug.tx(Therm1[1])
debug.tx(Therm2[0])
debug.tx(Therm2[1])
debug.tx(Therm3[0])
debug.tx(Therm3[1])
debug.tx(Therm4[0])
debug.tx(Therm4[1])
{
display(string("transmit")) 'For USB output
debug.hex(Sync[0],2)
debug.hex(Sync[1],2)
debug.str (@space)
debug.hex(CheckSum,2)
debug.str (@space)
debug.hex(ComByte,2)
debug.str (@space)
debug.hex(Error[0],2)
debug.hex(Error[1],2)
debug.tx(13)
debug.hex(Therm1[0],2)
debug.hex(Therm1[1],2)
debug.str (@space)
debug.hex(Therm2[0],2)
debug.hex(Therm2[1],2)
debug.str (@space)
debug.hex(Therm3[0],2)
debug.hex(Therm3[1],2)
debug.str (@space)
debug.hex(Therm4[0],2)
debug.hex(Therm4[1],2)
debug.tx(13)
}

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-11-01 16:00
    From the partial piece of code you've shown, there's nothing that would explain what's happening. Debug, Uart1, and Uart2 are different objects, all referring to different I/O pins (I hope). I think Debug uses FullDuplexSerial internally and all 3 instances should be in separate cogs working independently. There must be something you're not showing that would explain what's going on.
  • steprogsteprog Posts: 227
    edited 2010-11-01 17:43
    Hi Mike,
    I think that is pretty much it. I will look it over, but you apparently see no reason it shouldn't work.
    Thats good.
    Thanks so far,
    Greg
  • Brian CarpenterBrian Carpenter Posts: 728
    edited 2010-11-01 22:02
    Can you show us your constants? If you havent stated the correct pins, this could be the case. Any chance we can take a look at that part?

    What pins do you have assigned to the following

    pcDebugRX
    pcDebugTX
    RX1
    TX1
    RX2
    TX2
  • steprogsteprog Posts: 227
    edited 2010-11-01 22:14
    Here you go.
    Thanks,
    Greg


    pcDebugRX = 31
    pcDebugTX = 30

    RX1 = 2
    TX1 = 3
    RX2 = 14
    TX2 = 15

    ' RX2 = 29
    ' TX2 = 28

    ' serial baud rates
    pcDebugBaud = 38400
    Mode = 0
Sign In or Register to comment.