Shop Learn
Any reason this cog won't start? — Parallax Forums

Any reason this cog won't start?

coginit returns $04, but I can't seem to get a pulse out of the cog. Can't even get it to toggle lines with DRVH and DRVL.

I am stumped.

PUB startfastrx(ptr1) : e131cog
  e131cog := coginit(COGEXEC_NEW, @cogx, ptr1)  + 1
  return

DAT

        org   0

cogx  setq      #3-1
      rdlong    l_socket, ptra

      mov l_BS, l_socket
      mov l_socket_rd, l_socket 'Setup the l_socket rd register
      add l_socket_rd, #$10   ' It is the value of the l_socket register + $10 

{snip my ungly code}

l_socket                  res     1
l_rxptr                   res     1
l_REGBUFFERTMP            res     1
l_i                       res     1
l_LADDRL                  res     1
l_LADDRH                  res     1
l_tmpdata                 res     1
l_RB                      res     1
l_datapin                 res     1
l_REGISTER                res     1
l_BLEN                    res     1
l_BS                      res     1
l_socket_rd               res     1
ll_RX_RSR                 res     1
ll_RX_RD                  res     1
l_r                       res     1

Comments

  • evanhevanh Posts: 13,112

    Works for me using some DRVx instructions.

    PUB startfastrx(ptr1) : e131cog
      e131cog := coginit(COGEXEC_NEW, @cogx, ptr1)  + 1
      return
    
    DAT
    
        org   0
    
    cogx
        drvl    #56
        drvh    #57
    
    .loop
        waitx   ##clkfreq_
        outnot  #56
        outnot  #57
        jmp #.loop
    
  • @evanh said:
    Works for me using some DRVx instructions.

    PUB startfastrx(ptr1) : e131cog
      e131cog := coginit(COGEXEC_NEW, @cogx, ptr1)  + 1
      return
    
    DAT
    
      org   0
    
    cogx
      drvl    #56
      drvh    #57
    
    .loop
      waitx   ##clkfreq_
      outnot  #56
      outnot  #57
      jmp #.loop
    

    That's almost exactly the test code I put it. Thanks @evanh. I will keep hunting for what I am doing wrong.

Sign In or Register to comment.