Shop OBEX P1 Docs P2 Docs Learn Events
COG6 Not blinking - Why? (what did I miss?) — Parallax Forums

COG6 Not blinking - Why? (what did I miss?)

Using 1-2-3 FPGA and 10-10-15 P2 image.

Ok, looks straight forward - COGINIT 1-7 then COG 0 kills itself. What I coded seems sensible to me. (famous last words)

1) they should all wait for a period before second COGINIT, they don't wait at all.

2) COG 6 should blink LED6 just like the others blink their LEDs - it doesn't

Can someone else with a 1-2-3 try it and see what they get?
dat
	orgh	0
	
	coginit	#$21,#@cogwait
	coginit	#$22,#@cogwait	
	coginit	#$23,#@cogwait	
	coginit	#$24,#@cogwait 
	coginit	#$25,#@cogwait
	coginit      #$26,#@cogwait
	coginit	#$27,#@cogwait	

	' kill COG0
	cogid	me
	cogstop	me

me	long	0

		org	0
' Build a COG image here 
cogwait		
		cogid	me2
		mov	ticks,#1
		shl	ticks,#25
		shl	ticks, me2
		setb	dirb,me2
		setb	outb,me2
		waitx	ticks
		notb	outb,me2
		coginit	me2,#@blink
' should never kill myself
		cogstop	me2
ticks		long	0
me2		long	0


		org	0
' build a COG image here
blink
		cogid	x
		setb	dirb,x
		notb	outb,x
		add	x,#16
		shl	x,#18
		waitx	x
		jmp	@blink
x		long	0

Comments

  • ....but if I do this:
    dat
    	orgh	0
    	
    	jmp	#@hihub
    me	long	0
    	
    	orgh	$70000
    hihub
    	coginit	#$21,##cogwait
    	coginit	#$22,##cogwait	
    	coginit	#$23,##cogwait	
    	coginit	#$24,##cogwait 
    	coginit	#$25,##cogwait
    	coginit #$26,##cogwait
    	coginit	#$27,##cogwait	
    
    	' kill COG0
    	cogid	me
    	cogstop	me
    
    
    		org	0
    ' Build a COG image here 
    cogwait		
    		cogid	me2
    		mov	ticks,#1
    		shl	ticks,#25
    		shl	ticks, me2
    		setb	dirb,me2
    		setb	outb,me2
    		waitx	ticks
    		notb	outb,me2
    		coginit	me2,##blink
    ' should never kill myself
    		cogstop	me2
    ticks		long	0
    me2		long	0
    
    
    		org	0
    ' build a COG image here
    blink
    		cogid	x
    		setb	dirb,x
    		notb	outb,x
    		add	x,#16
    		shl	x,#18
    		waitx	x
    		jmp	@blink
    x		long	0
    

    all 7 started COGS blink!

    The delays in cogwait still don't work and my brain tells me they should.

    I pretty much just pushed everything up into high (very high in this example) HUBRAM.

    Also, ##target worked on the COGINIT instructions. I need to go back to my other COG test program to see if that works - I thought I had tried it and failed.
Sign In or Register to comment.