This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LP-AM243: PRU - Having Trouble getting CRC16-CCITT working

Part Number: LP-AM243

I am using the LP-AM243 with CCS, running the Hello World example of R5F with syscfg set to enable PRU.
Then I am using the empty PRU example for the LP, and trying to use the HW CRC module with assembly.

I have a function in assembly I am using to try and do a CRC check.
This is based on the descriptions from the TRM and an 8b/10b document on the PRU.

GEN_CRC:
; Load the "R" registers with values needed to control CRC module
    ldi32   r25, 0x00000000
    ldi32   r29, 0x00000021
    
; use XFR to control CRC module via "R" registers
    xout    0x01, &r25, 4
    xout    0x01, &r29, 1

; TRM says to insert 1~2 nop as the CRC conversion takes time
    nop
    nop

    
; read the result of the CRC conversion
    xin     0x01, &r28, 4

  • As shown in above code, with default settings (r25 = 0x0, not writing r28 with a seed, etc) I get the CRC16/ARC result - confirmed with crccalc.com
  • But I am trying to get the CRC16-CCITT result, and so I modified the code as follows (r25 = 0x04 to select CRC16-CCITT; and use r28 to load SEED as described in TRM)

GEN_CRC:
; Load the "R" registers with values needed to control CRC module
    ldi32   r25, 0x00000004
    ldi32 r28, 0xFFFFFFFF
    ldi32   r29, 0x00000021
    
; use XFR to control CRC module via "R" registers
    xout    0x01, &r25, 4
    xout    0x01, &r28, 4
    xout    0x01, &r29, 1
    
; TRM says to insert 1~2 nop as the CRC conversion takes time
    nop
    nop
    
; read the result of the CRC conversion
    xin     0x01, &r28, 4

But doing this gives me no result applicable to any of the CRC16 types.

What am I doing wrong?

EDIT (2023/11/15): I forgot to mention in my code I am also including the 1~2 nops as indicated in the TRM; I have updated the code above to include the nops