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!

Parents
  • 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

Reply
  • 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

Children
  • 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

Related