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.
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
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
Hi Keito,
The experts on this matter are on holiday (11/14 - 11/15). The response may be delayed. Thank you for your patience.
Best regards,
Ming
Hi Nilabh,
That post has "--internal" in the link name, and I am unable to open it; is it not available publicly?
Hi Nilabh,
It seems I misunderstood the order of the bits into the CRC module to get the desired result.
The sample code helped, thanks!
By the way, next I'd like to do CRC on a bunch of bytes.
Referencing the TRM: 6.4.6.2.2.3 PRU and CRC16/32 Interface (R9:R2)
Do you have any sample code getting CRC16 result on multiple bytes of data stored in R9:R2?
This was what I originally was trying to do...
Hi Nilabh,
Nevermind, I figured it out.
I just need to change from R29 -> R2 as the CRC input, and add a bunch of NOPs.
Then if I am careful how I arrange the data fed into the module, I can do CRC on up to 32 bytes. Great!
LDI R2.w0, DATA16 ;Move the data to R29 register XOUT CRC_XID, &R2.w0, 2 ;Moving 2 bytes NOP NOP NOP NOP NOP NOP NOP NOP NOP