This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF_CCM with on-the-fly transmissions are truncated OTA with nRF52840

I have the NRF_CCM peripheral setup to encrypt packets on-the-fly. I can verify packets are properly encrypted when the payload size is 27 bytes or smaller. However, anything greater than 27 bytes of payload is truncated. I can see in the encrypted buffer pointed to by NRF_CCM->OUTPTR contains the correct length (non-truncated length, with the +4 MIC length).

I expected this issue may be a result of the extended length setting in NRF_CCM. But have the bit correctly enabled.

    NRF_CCM->MODE = ((uint32_t)CCM_MODE_MODE_Encryption << CCM_MODE_MODE_Pos     ) |
                    ((uint32_t)CCM_MODE_DATARATE_1Mbit  << CCM_MODE_DATARATE_Pos ) |
                    ((uint32_t)CCM_MODE_LENGTH_Extended << CCM_MODE_LENGTH_Pos   );

I have also checked the max length register. I used various values in this register to see if I can get a different response. But the result is an OTA max value of 27 bytes.

    NRF_CCM->MAXPACKETSIZE = (uint32_t)0xFB;

From another forum post, I can see that toggling the enable can help. I tried this too but to no avail.

    NRF_CCM->ENABLE = ((uint32_t)CCM_ENABLE_ENABLE_Disabled << CCM_ENABLE_ENABLE_Pos );
    NRF_CCM->ENABLE = ((uint32_t)CCM_ENABLE_ENABLE_Enabled  << CCM_ENABLE_ENABLE_Pos );

I have also verified the KSGEN is triggered well in advance of READY. I measured 251-us. Image attached below.

Any alternative debugging tips would be appreciated. Thanks in advance.

Parents Reply Children
Related