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

Has the DFEPACKET.PTR to be word-aligned?

Hello,

I am developing an nrf52811 BLE Direction Finding firmware.

During packet reception I would like to store the IQ samples on a uint8_t buffer right after some other (packet) data. I observed that this only works, if the part before the IQ data is a multiple of four bytes, i.e. if the DFEPACKET.PTR is word-aligned.

Before I am going to get crazy, let me ask: Am I right that the DFEPACKET.PTR has to be word-aligned? If so, it would be nice to have this information in the documentation.

Thanks in advance and best regards!

  • Hi

    That is correct. All pointers using EasyDMA must be word-aligned. As stated here, you can check out the Memory chapter to see which memories are available for EasyDMA.

    Best regards,

    Simon

  • Hi Simon,

    Thank you for the quick reply.

    Unfortunately, I do not see any statements regarding word alignment and EasyDMA in the documentation. The only bit of information regarding word alignment can be found in the Writing to flash section, which obviously doesn't apply here.

    Contrary to your statement,

    All pointers using EasyDMA must be word-aligned

    the description of the RADIO->PACKETPTR register states that "This address is a byte aligned RAM address". From this, not all EasyDMA pointers have to be word-aligned.

    I am confused.

    Best regards!

  • Hi

    Indeed, the product specification doesn't say this specifically, but in section 4.3.1 Writing to flash, it is stated that "Only word-aligned writes are allowed. Byte or half-word-aligned writes will result in a hard fault." You should always assume that this is the case for memory address unless something else is stated.

    Best regards,

    Simon

  • Hi Simon,

    Well, firstly, EasyDMA cannot access the flash memory, hence this section 4.3.1 Writing to flash should be completely irrelevant here. Secondly, the RADIO->PACKETPTR register description states, and I can confirm this based on a real hardware test I just made, that EasyDMA can access (read in TX mode and write in RX mode) the RAM at arbitrary byte-aligned addresses.

    From this, there is no reason to assume a different behaviour for the IQ sampling. I really would appreciate to have this information in the documentation (as it would be for e.g. the PHYEND event behaviour or the IQ sample behaviour).

    For reference: Based on my tests, the specified RADIO->DFEPACKET.PTR address gets truncated to the previous word boundary. This may be irrelevant when using a buffer like e.g.

    uint32_t iqSample[NUM_OF_SAMPLES];
    RADIO->DFEPACKET.PTR = (uint32_t) iqSample;

    since most C compilers will align this to a word boundary, but may be relevant in a situation like I described in my original post in this thread.

    Best regards,

    Gerrit Maus

  • Hi Gerrit

    You're correct, of course. I'm sorry about any confusion. Thank you for the thorough testing that you've done. I will put in a request for including this in the documentation, but it might take some time before it makes its way into public documentation. 

    Best regards,

    Simon

Related