Propeller randomly stops executing Spin Code
Hi,
I ran into an issue with the Propeller which I cant solve myself. It seems to me that the Propeller randomly stops executing SPIN code. Running PASM code in a seperat cog is working fine.
I wrote a simple program which blinks leds in 3 different ways.
1. Start a cog with PASM Code
2. Start an additional cog with SPIN Code
3. Run SPIN Code on the main cog
Both methods which execute SPIN code stop toggling the LED after a few seconds. Sometimes the LED dont even blink once.
Number 2 with PASM code is toggling the LED endlessly and is unaffected when the other Methods stops.
Methods 2 or 3 stops after a few seconds and the LEDs. But Method 3 is unaffected and toggles endlessly the Led´s.
I also have to say that i have problems programming with the Serial Port. I need several tries until the Propeller tool finds the Propeller on the Port, maybe this can be a reason for this odd behaviour.
So can it be that the Propeller is broken ?
I ran into an issue with the Propeller which I cant solve myself. It seems to me that the Propeller randomly stops executing SPIN code. Running PASM code in a seperat cog is working fine.
I wrote a simple program which blinks leds in 3 different ways.
1. Start a cog with PASM Code
2. Start an additional cog with SPIN Code
3. Run SPIN Code on the main cog
Both methods which execute SPIN code stop toggling the LED after a few seconds. Sometimes the LED dont even blink once.
Number 2 with PASM code is toggling the LED endlessly and is unaffected when the other Methods stops.
Methods 2 or 3 stops after a few seconds and the LEDs. But Method 3 is unaffected and toggles endlessly the Led´s.
I also have to say that i have problems programming with the Serial Port. I need several tries until the Propeller tool finds the Propeller on the Port, maybe this can be a reason for this odd behaviour.
So can it be that the Propeller is broken ?
CON
_clkmode = xtal1 + pll16x 'Standard clock mode * crystal frequency = 80 MHz
_xinfreq = 5_000_000
PUB public_method_name
'start a cog with PASM code
cognew(@entry,0)
'start an additional cog with SPIN code
cognew(blink,0)
'use current cog
dira[16] := 1
repeat
waitcnt(cnt + 20_000_000)
!outa[16]
PUB blink
dira[18] := 1
repeat
waitcnt(cnt + 20_000_000)
!outa[18]
DAT
org
entry mov r0,#1
shl r0,#17
mov dira,r0
loop xor outa,r0
mov r1,cnt
add r1,wait
waitcnt r1,#0
jmp #loop
r0 long 1
r1 long 1
wait long 20_000_000

Comments
CON {Object_Title_and_Purpose} CON _clkmode = xtal1 + pll16x 'Standard clock mode * crystal frequency = 80 MHz _xinfreq = 5_000_000 VAR long symbol long stack[10] PUB public_method_name dira[16] := 1 cognew(@entry,0) cognew(blink,@stack) repeat waitcnt(cnt + 20_000_000) !outa[16] PUB blink dira[18] := 1 repeat waitcnt(cnt + 20_000_000) !outa[18] DAT org entry mov r0,#1 shl r0,#17 mov dira,r0 loop xor outa,r0 mov r1,cnt add r1,wait waitcnt r1,#0 jmp #loop r0 long 1 r1 long 1 wait long 20_000_000and when i deleted the method like this its still the same
CON {Object_Title_and_Purpose} CON _clkmode = xtal1 + pll16x 'Standard clock mode * crystal frequency = 80 MHz _xinfreq = 5_000_000 VAR long symbol PUB public_method_name dira[16] := 1 cognew(@entry,0) repeat waitcnt(cnt + 20_000_000) !outa[16] DAT org entry mov r0,#1 shl r0,#17 mov dira,r0 loop xor outa,r0 mov r1,cnt add r1,wait waitcnt r1,#0 jmp #loop r0 long 1 r1 long 1 wait long 20_000_000Here's an example of blinking three LEDs: one with PASM, one in a secondary Spin cog, one in the main Spin cog. This is running on a demo board so I know it works.
con _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 ' use 5MHz crystal var long spinstack[16] pub main | t pbmask := 1 << 16 ' mask for pin 16 pbdelaytix := clkfreq / 1000 * 250 cognew(@pasmblink, 0) ' start pasm cog cognew(spin_blink(17, 250), @spinstack) ' start spin cog ' run in main cog dira[18] := 1 ' make output t := cnt ' sync with system repeat outa[18] := 1 ' high waitcnt(t += (clkfreq / 1000 * 250)) ' wait outa[18] := 0 ' low waitcnt(t += (clkfreq / 1000 * 250)) ' wait pri spin_blink(pin, ms) | t ' launch with cognew dira[pin] := 1 ' make output t := cnt ' sync with system repeat outa[pin] := 1 ' high waitcnt(t += (clkfreq / 1000 * ms)) ' wait outa[pin] := 0 ' low waitcnt(t += (clkfreq / 1000 * ms)) ' wait dat org 0 pasmblink mov tix, pbdelaytix ' setup delay add tix, cnt ' sync with system or dira, pbmask ' make output :loop or outa, pbmask ' high waitcnt tix, pbdelaytix ' wait andn outa, pbmask ' low waitcnt tix, pbdelaytix ' wait jmp #:loop ' --------------------------------------------------------------------------------------- pbmask long 0-0 pbdelaytix long 0-0 tix res 1 fit 496Your Code seems to work.
I ran your second program (above my last post) and it seems to work fine.
I have now 0,1uF caps there, and it seem all the codes with the Led´s work fine.
But the Problem with the Grafic Demos are still there , they are little bit better but not much.
When i take the GraficsTest.spin that comes with the Propeller Tool, i get only a Black and White screen that starts moving for short time (0.5 - 1,5 sec sometimes 3-5 but not very often) and then hang up.
I Try other Grafic demos too but non of them work fine, i checked the Crystal and the Resistors.
So any ideas what´s the Problem ?