Strange problem with serial out on my project...
Chris_D
Posts: 305
Hey guys,
I am stumped. I am working with a propeller chip - it has been working good for
several days communicating with a keyboard, mouse, my AVR, and producing VGA
display output.· This is all on my own circuit board
Sometime this afternoon, suddenly it was no longer outputting data to my AVR via
serial 57600 baud. I can send data to it and it receives it fine and displays
the proper information on the VGA display.
Seeing as I have not been programming the prop, I don't think the software changed so I
assumed it was something on my AVR. However, I put my scope on the transmit
signal from the PROPELLER and noticed I am getting a fairly consistant square
wave. My scopes knobs are a bit "testy", but I believe the signal I am seeing
is .2msecs off and .4 msecs ON. During this, it should not be transmitting
anything. It should only be transmitting during a keypress or mouse click.
I also used my VOM's frequency measurement function and it is showing a
frequency of 1.64 Khz.
What the heck could be causing this?
Chris
I am stumped. I am working with a propeller chip - it has been working good for
several days communicating with a keyboard, mouse, my AVR, and producing VGA
display output.· This is all on my own circuit board
Sometime this afternoon, suddenly it was no longer outputting data to my AVR via
serial 57600 baud. I can send data to it and it receives it fine and displays
the proper information on the VGA display.
Seeing as I have not been programming the prop, I don't think the software changed so I
assumed it was something on my AVR. However, I put my scope on the transmit
signal from the PROPELLER and noticed I am getting a fairly consistant square
wave. My scopes knobs are a bit "testy", but I believe the signal I am seeing
is .2msecs off and .4 msecs ON. During this, it should not be transmitting
anything. It should only be transmitting during a keypress or mouse click.
I also used my VOM's frequency measurement function and it is showing a
frequency of 1.64 Khz.
What the heck could be causing this?
Chris
Comments
*Peter*
The schematics are identical to the Demo board schematics - from which I built this circuit board.
Here is the source code
**************************************************************************************
'Riam-VGA Display Interface
'4/29/09 - modified to run on RIAM board
'tested baud at 115200 - missing lots of characters, went back to 57600
'added logic to blink LEDs for Keyboard, Mouse, & video feed
CON
· _clkmode = xtal1 + pll16x
· _xinfreq = 5_000_000
· cols = vgatext#cols
· rows = vgatext#rows
· chrs = cols * rows
OBJ
· vgatext : "vga_hires_text"
· mouse·· : "mouse"
· SerIO·· : "FullDuplexSerial"·············· 'Serial communications object
·· kb : "keyboard"
VAR
· 'sync long - written to -1 by VGA driver after each screen refresh
· long· sync
· 'screen buffer - could be bytes, but longs allow more efficient scrolling
· byte· screen[noparse][[/noparse]cols*rows]
· 'row colors
· word· colors[noparse][[/noparse]rows]
· 'cursor control bytes
· byte· cx0, cy0, cm0, cx1, cy1, cm1
· Byte DispCmd······· 'Command for video display
····················· '1 show text
· Long DispX········· 'Column position of text to show
· Long DispY········· 'Row position of text to show
· Byte DispText[noparse][[/noparse]100]· 'ASCII codes of text to show
· Byte Mcu_Status
· Byte Temp
· Long TempL
· Long Index1
· Long Index2
· word At_Key
· byte Special_Code
· Long Prev_M_X
· Long Prev_M_Y
· Long Current_M_X
· Long Current_M_Y
· Long M_Prev_LeftB
· Long M_Current_LeftB
· Byte Mouse_Down
· Byte Mouse_Up
· Byte Active_Editor
······· '0 = none
······· '1 = CNC editor
······· '2 = sub screen editor
· Byte Min_Line_Len
· Byte Max_Line_Len
·
PUB start | i, j, k
· 'start vga text driver
· vgatext.start(16, @screen, @colors, @cx0, @sync)
·· 'start the keyboard
· kb.start(26, 27)
· 'echo keystrokes in hex
·' repeat
·· ' term.hexd(kb.getkey,3)
'··· Term.dec(kb.getkey)'
'·· term.out(" ")
· 'start mouse and set bound parameters
· mouse.start(24, 25)
· mouse.bound_limits(0, 0, 0, cols - 1, rows - 1, 0)
· mouse.bound_scales(2, -3, 0)
'· SerIO.start(7, 6, 0, 38400)
· SerIO.start(31, 30, 0, 57600)
· 'Rx pin is 31
· 'Tx pin is 30
· 'Set LEDs as outputs
· Dira[noparse][[/noparse]10]~~··················· 'Keyboard
· Dira[noparse][[/noparse]11]~~··················· 'Mouse
· Dira[noparse][[/noparse]12]~~··················· 'Video
·
·'set up colors
· repeat i from 0 to 19
··· colors[noparse][[/noparse]i] := %%3330_0030
· repeat i from 20 to rows - 3
···· colors[noparse][[/noparse]i] := %%3330_0000
···
· colors[noparse][[/noparse]48] := %%3330_3000
· colors[noparse][[/noparse]49] := %%3330_3000
·
· 'fill screen with characters
· repeat i from 0 to chrs - 1
··· k := k + 1
··· screen.byte[noparse][[/noparse]i] := 32' // $81
··· if k == 100
······ k:= 0
· Repeat i from 4800 to 4899
··· Screen.byte[noparse][[/noparse]i] := 14 // $81
·
· 'set cursor 0 to be a solid block
· cm0 := %001
· 'set cursor 1 to be a blinking underscore
· cm1 := %111
· M_Prev_LeftB := 0
· Mouse_Down := 1
· Mouse_Up := 2
· Mcu_Status := 0
· cx1 := 0
· cy1 := 49
· repeat
··· at_Key := kb.key
··· SerIO.tx(at_Key)
····· if at_Key <> 0
······· !outa[noparse][[/noparse]10]
···· DispCmd := 0
···· DispCmd := SerIO.rxtime(5)
···· Case DispCmd
······· 27:············································ 'Escape key sequence - special operation
·········· Special_Code := SerIO.rxtime(5)
·········· case Special_Code
············ 1:······································ 'Clear screen
················ repeat i from 0 to chrs - 1
···················· screen.byte[noparse][[/noparse]i] := 32
············ 100:······································ 'place cursor at program line editor
················ cx1 := 0
················ cy1 := 20
················ Active_Editor := 1
················ Min_Line_Len := 0
················ Max_Line_Len := 74
············ 101:······································ 'place cursor at second screen editor
················ cx1 := 76
················ cy1 := 20
················ Active_Editor := 2
················ Min_Line_Len := 76
················ Max_Line_Len := 99
············ 102:······································ 'place cursor at abs x position
················ Special_Code := SerIO.rxtime(5)
················ cx1 := Special_Code
················ cy1 := 20
············ 103:······································ 'place cursor on status line
················ cx1 := 1
················ cy1 := 49
······· 10:
·········· !outa[noparse][[/noparse]12]
·········· Fetch_Long(@DispX)
·········· Fetch_Long(@DispY)
·········· Index1 := ((DispY * 100)+DispX)
·········· Index2 := 0
·········· Repeat
············ Temp := SerIO.rx'time(1)
············ if Temp > 0
··············· screen[noparse][[/noparse]Index1] := Temp
··············· index1 := index1 + 1
··············· SerIO.tx(Mcu_Status)
·········· while Temp > 0
·········· DispCmd := 0
·········· SerIO.tx(Mcu_Status)
······· 223:··········································· 'pause break key - only temporary for clear screen testing
·········· repeat i from 0 to chrs - 1
············ screen.byte[noparse][[/noparse]i] := 32
······· 193:
········· if cx1 < Max_Line_Len
············ cx1 := cx1 + 1
········· cy1 := 20
······· 192:
········· if cx1 > Min_Line_Len
············ cx1 := cx1 - 1
········· cy1 := 20
· 'main loop - mouse controls stuff
··· cx0 := mouse.bound_x····· 'cursor 0 follows mouse
··· cy0 := mouse.bound_y
··· if mouse.button(0)······· 'if left-click, cursor 1 moves to mouse
····· !outa[noparse][[/noparse]11]
····· repeat while mouse.button(0) 'clears out buffer so multiple 'clicks' are not passed through
····· Current_M_X := mouse.bound_x
····· Current_M_Y := mouse.bound_y
····· SerIO.Tx(Mouse_Down)
····· SerIO.Tx(Current_M_X)
····· SerIO.Tx(Current_M_Y)
PRI Fetch_Long(LongToFetch)| LocalByte,local_long
····· LocalByte := SerIO.Rx
····· local_long.byte[noparse][[/noparse]0] := LocalByte
····· LocalByte := SerIO.Rx
····· local_long.byte[noparse][[/noparse]1] := LocalByte
····· LocalByte := SerIO.Rx
····· local_long.byte[noparse][[/noparse]2] := LocalByte
····· LocalByte := SerIO.Rx
····· local_long.byte[noparse][[/noparse]3] := LocalByte
····· LONG[noparse][[/noparse]LongToFetch] := Local_Long
····· Return
·
PRI Xmit_Long(LongToSend)| LocalByte
····· LocalByte := LongToSend.byte[noparse][[/noparse]0]
····· SerIO.tx(LocalByte)
····· LocalByte := LongToSend.byte[noparse][[/noparse]1]
····· SerIO.tx(LocalByte)
····· LocalByte := LongToSend.byte[noparse][[/noparse]2]
····· SerIO.tx(LocalByte)
····· LocalByte := LongToSend.byte[noparse][[/noparse]3]
····· SerIO.tx(LocalByte)
····· return
·
{{
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│·················································· TERMS OF USE: MIT License················································· │···························································
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation··· │
│files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,··· │
│modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software│
│is furnished to do so, subject to the following conditions:·································································· │
│····························································································································· │
│The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.│
│····························································································································· │
│THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE········· │
│WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR········ │
│COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,·· │
│ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.························ │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
}}·
I suspect you are right.· That helps me to narrow this down further.· I will dissable the keyboard function to get closer to the source of the problem.
Thanks
Chris
Thanks for the help guys.
Chris