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

nRF8001 event size seems wrong in aci_evts.h

In the nRF8001 Product Specification, section 7.1.5 it states:

"The maximum length of an event packet is 31 bytes, including the length byte."

In the headers it's defined as 33 bytes (see here).

To fix that, I needed to make the following changes. In the aci_evt_params_cmd_rsp_t struct:

-    uint8_t                                     padding[29];  
+    uint8_t                                     padding[27];

-ACI_ASSERT_SIZE(aci_evt_params_cmd_rsp_t, 31);
+ACI_ASSERT_SIZE(aci_evt_params_cmd_rsp_t, 29);

-ACI_ASSERT_SIZE(aci_evt_t, 33);
+ACI_ASSERT_SIZE(aci_evt_t, 31);

...and then in lib_aci.h:

-ACI_ASSERT_SIZE(hal_aci_evt_t, 34);
+ACI_ASSERT_SIZE(hal_aci_evt_t, 32);

Can anyone comment on this? What am I missing?

Parents
  • -    uint8_t                                     padding[29];  
    +    uint8_t                                     padding[27];
    
    -ACI_ASSERT_SIZE(aci_evt_params_cmd_rsp_t, 31);
    +ACI_ASSERT_SIZE(aci_evt_params_cmd_rsp_t, 29);
    
    -ACI_ASSERT_SIZE(aci_evt_t, 33);
    +ACI_ASSERT_SIZE(aci_evt_t, 31);
    

    The size of the ACI event is 31 bytes and is correct as per the specification. This is correct as the Command Response has the command opcode and the status opcode use 1 byte each. The length and the event opcode uses 1 byte each, so the padding is 31 - (1+1+1+1) = 27 bytes. The size of the aci_evt_params_cmd_rsp_t is 31 - (1+1) = 29 bytes

    -ACI_ASSERT_SIZE(hal_aci_evt_t, 34);
    +ACI_ASSERT_SIZE(hal_aci_evt_t, 32);
    

    This also appears correct as the hal_aci_evt_t has a byte in front to reflect that the ACI event when received over the SPI has an additonal status byte in front. I.e. this event needs to be size of the aci event + 1.

    Your comments are correct.

Reply
  • -    uint8_t                                     padding[29];  
    +    uint8_t                                     padding[27];
    
    -ACI_ASSERT_SIZE(aci_evt_params_cmd_rsp_t, 31);
    +ACI_ASSERT_SIZE(aci_evt_params_cmd_rsp_t, 29);
    
    -ACI_ASSERT_SIZE(aci_evt_t, 33);
    +ACI_ASSERT_SIZE(aci_evt_t, 31);
    

    The size of the ACI event is 31 bytes and is correct as per the specification. This is correct as the Command Response has the command opcode and the status opcode use 1 byte each. The length and the event opcode uses 1 byte each, so the padding is 31 - (1+1+1+1) = 27 bytes. The size of the aci_evt_params_cmd_rsp_t is 31 - (1+1) = 29 bytes

    -ACI_ASSERT_SIZE(hal_aci_evt_t, 34);
    +ACI_ASSERT_SIZE(hal_aci_evt_t, 32);
    

    This also appears correct as the hal_aci_evt_t has a byte in front to reflect that the ACI event when received over the SPI has an additonal status byte in front. I.e. this event needs to be size of the aci event + 1.

    Your comments are correct.

Children
No Data
Related