Propeller to Propeller Chip Communication Via RS-232 Using FullDuplexSerial.
Balzer365
Posts: 7
Hello,
·
I am AT1 Balzer, I am working on designing a test set for some equipment we repair.· I have a system board running a Propeller Chip and a Relay board running a Propeller Chip.· Both are still in the design stages.· I have them prototyped out on a bread board.· I want to use FullDuplexSerial to communicate from the System board to the Relay board.· Right now only the System board sends commands and the Relay board listens and carries out the commands it receives.
·
The problem I am having is an intermittent communication problem, on the 7th or 8th send of commands the relay board misses one of the commands, and then picks the next command up.· I have included the code for the system board and Relay board.· They are connected together with wires, not sure if I need a resistor between them or not.· Any help would be greatly appreciated.
Thanks
System Code:
Con
_Clkmode········· = xtal1 + pll16x
_Xinfreq········· = 5_000_000
Obj
MonitorCC : "Monitor Cable Connection"
LCD······ : "GLK19264"
DataBus·· : "FullDuplexSerial"
pub main
MonitorCC.Start(18,1)
LCD.Start(15,14,0,19200)
DataBus.Start(13,12,0,19200)
dira[noparse][[/noparse]16]~~
outa[noparse][[/noparse]16]~~
LCD.Brightness(255)
LCD.CLR
LCD.Cursor_Position(2,1)
LCD.Str( string(" SENDING K1 ON COMMAND···· "))
LCD.Cursor_Position(2,2)
LCD.Str( string("····· VIA DATA BUS····· "))
DataBus.TX(66)
waitcnt (clkfreq*4 + cnt)
LCD.CLR
LCD.Cursor_Position(2,1)
LCD.Str( string(" SENDING K2 ON COMMAND···· "))
LCD.Cursor_Position(2,2)
LCD.Str( string("····· VIA DATA BUS····· "))
DataBus.TX(67)
waitcnt (clkfreq*4 + cnt)
DataBus.TX(68)
LCD.CLR
LCD.Cursor_Position(2,1)
LCD.Str( string(" UWATS SELF TEST COMPLETE "))
LCD.Cursor_Position(2,2)
LCD.Str( string("····· RESETTING RELAYS····· "))
LCD.Cursor_Position(2,3)
LCD.Str( string(" CONNECT UUT CABLE ASSEMBLY "))
Relay Board Code:
Con
· _clkmode = xtal1 + pll16x
· _xinfreq = 5_000_000
·
·
Var Byte Value
OBJ
· DataBus:· "FullDuplexSerial"
PUB Main
· DataBus.Start(0,1,0,19200)
·
· repeat
···
··· Value := DataBus.rxcheck
······· Case Value
········· 66 : Dira[noparse][[/noparse]2]~~
·············· Outa[noparse][[/noparse]2]~~
········· 67 : Dira[noparse][[/noparse]3]~~
·············· Outa[noparse][[/noparse]3]~~
········· 68 : Dira[noparse][[/noparse]2..3]~
·············· Outa[noparse][[/noparse]2..3]~
···················································
·······
·········
·········
·········
·······
·····
·····
·
·
·
·
··
·
·
·
··
·
·
·····
·
·
··
·
·
·····
·
·
I am AT1 Balzer, I am working on designing a test set for some equipment we repair.· I have a system board running a Propeller Chip and a Relay board running a Propeller Chip.· Both are still in the design stages.· I have them prototyped out on a bread board.· I want to use FullDuplexSerial to communicate from the System board to the Relay board.· Right now only the System board sends commands and the Relay board listens and carries out the commands it receives.
·
The problem I am having is an intermittent communication problem, on the 7th or 8th send of commands the relay board misses one of the commands, and then picks the next command up.· I have included the code for the system board and Relay board.· They are connected together with wires, not sure if I need a resistor between them or not.· Any help would be greatly appreciated.
Thanks
System Code:
Con
_Clkmode········· = xtal1 + pll16x
_Xinfreq········· = 5_000_000
Obj
MonitorCC : "Monitor Cable Connection"
LCD······ : "GLK19264"
DataBus·· : "FullDuplexSerial"
pub main
MonitorCC.Start(18,1)
LCD.Start(15,14,0,19200)
DataBus.Start(13,12,0,19200)
dira[noparse][[/noparse]16]~~
outa[noparse][[/noparse]16]~~
LCD.Brightness(255)
LCD.CLR
LCD.Cursor_Position(2,1)
LCD.Str( string(" SENDING K1 ON COMMAND···· "))
LCD.Cursor_Position(2,2)
LCD.Str( string("····· VIA DATA BUS····· "))
DataBus.TX(66)
waitcnt (clkfreq*4 + cnt)
LCD.CLR
LCD.Cursor_Position(2,1)
LCD.Str( string(" SENDING K2 ON COMMAND···· "))
LCD.Cursor_Position(2,2)
LCD.Str( string("····· VIA DATA BUS····· "))
DataBus.TX(67)
waitcnt (clkfreq*4 + cnt)
DataBus.TX(68)
LCD.CLR
LCD.Cursor_Position(2,1)
LCD.Str( string(" UWATS SELF TEST COMPLETE "))
LCD.Cursor_Position(2,2)
LCD.Str( string("····· RESETTING RELAYS····· "))
LCD.Cursor_Position(2,3)
LCD.Str( string(" CONNECT UUT CABLE ASSEMBLY "))
Relay Board Code:
Con
· _clkmode = xtal1 + pll16x
· _xinfreq = 5_000_000
·
·
Var Byte Value
OBJ
· DataBus:· "FullDuplexSerial"
PUB Main
· DataBus.Start(0,1,0,19200)
·
· repeat
···
··· Value := DataBus.rxcheck
······· Case Value
········· 66 : Dira[noparse][[/noparse]2]~~
·············· Outa[noparse][[/noparse]2]~~
········· 67 : Dira[noparse][[/noparse]3]~~
·············· Outa[noparse][[/noparse]3]~~
········· 68 : Dira[noparse][[/noparse]2..3]~
·············· Outa[noparse][[/noparse]2..3]~
···················································
·······
·········
·········
·········
·······
·····
·····
·
·
·
·
··
·
·
·
··
·
·
·····
·
·
··
·
·
·····
·
Comments
It would help greatly if you would break up your code into two groups.
Place each group between the "(code) write code here(/code)" tags You must use the square brackets in place of the "(". Like this
This will preserve your indentation and help us decipher which object is going to what.
James L
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
James L
Partner/Designer
Lil Brother SMT Assembly Services
Not following can you gime me a better example.
Thanks,
·
··
·
·
·····
·
·
··
·
·
·····
If you do not include
The format of your code will be not spaced correctly. Spin requires spacing to be correct.
The tags use the brackets like shown above with the following format:
(code) your spin code here(/code) ( must be replaced with [noparse][[/noparse].
Hope this helps.
James
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
James L
Partner/Designer
Lil Brother SMT Assembly Services
System Board Code:
Relay Board Code:
Cheers!
Paul Rowntree
The system only loops through once. I do not see how you see any LCD activity after the three TX (transmits) from the system board.
You really need a looping code to see it more than three times.
If you car calling this from another method (or object) you need to do the following:
Call the start method once. The after that "main".
If you are doing this fast the display may be in a reset state when you are getting data.
We would need your full code if you are not providing it, to help further.
James L
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
James L
Partner/Designer
Lil Brother SMT Assembly Services
With the system board you are correct it only loops once.· The LCD works 5.0 picks up evey bit of information that is transfered to it.· The way that I loop it is I just use the reset button for testing purposes.· The problem that I am having is with the databus, theres 3 transmit statments Databus.tx(66), Databus.tx(67) and Databus.tx(68).· These codes get trasmitted to the relay board.· The relay board works most of the time, but it seems like the 7th or 8th time I hit the reset button on the system board(to run the code again), the relay board will miss one of the commands and then pick the next code up or wait until I reset the system board again.· I was thinking maybe I needed to flush the rx buffer, but attemps to do so made the relay board more unstable.
Thanks for the assistance
Ryan
Paul,
With that statement when the system board transmitted 68 to the relay board via Databus.tx(68)· I wanted the relay board to make I/O Pins 2 and 3 Low I guess I could get rid of the Dira statement because I don't need them to be inputs.·
Thanks for the assistance
Ryan
DataBus.Start(0,1,0,19200) will start a COG running the serial interface driver and you assigned it the pins 0 and 1.
So, you should not to a
dira~~/outa~~ which changes all ports. Of course in your case it won't change anything, but it's bad practice which you should not get used to.
Why do you use rxcheck and not rx? First I would change that to rx. And write the received byte on 8 port pins with LEDs attached to see what the relais board really receives. I would guess that you have a problem with the reset. During reset the ports are set to inputs. If you don't have a pull-down resistor there might be noise on the tx line of your system board, which confuses the relais board.
You could also change the system board software to a endless loop and see if the relais board misses transmissions then as well.
Thanks for the information, I am currently deployed and work a 12hr shift as soon as I can I will give your ideas a try.· I will keep everyone informed.
Thanks,
Ryan
Ryan
·
I too would like to know what the problem was.
James L
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
James L
Partner/Designer
Lil Brother SMT Assembly Services
Thanks again for all the help.
Ryan
··
Well, I'm glad you have it working without missing data. Resetting one board of the system may have confused the receiver board. With the loop, you will not have the reset issue.
James L
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
James L
Partner/Designer
Lil Brother SMT Assembly Services