Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

ATT_MTU throughput example: data received by responder?

Hello, I'm running the nRF5 SDK's ATT_MTU throughput example and I want to check that the data sent by the 'tester' (nRF52832 in my case) is effectively received by the 'responder' (nRF52840 in my case).

I can check the data sent by the tester but don't see where the data received by the responder can be found in the code.

Anyone that can help me, or tell what I need to do to find it? Thank you very much!

Parents
  • Hi

    If I understand you correctly you are looking for the code that receives notifications sent by the amt server?

    Incoming notifications are handled by the on_hvx(..) function on line 135 of amtc.c, which forwards the data to the registered AMT client callback. In the standard example this is the function called amtc_evt_handler(..), which is defined on line 472 of main.c

    As you can see this callback can respond to different types of events, and the event corresponding to an incoming notification is the NRF_BLE_AMT_C_EVT_NOTIFICATION event. 

    Hopefully this made it a bit clearer ;)

    Best regards
    Torbjørn

  • Hi,

    Thanks for this info. It confirms I was on the right track, which is always good to know. But my question obviously wasn't clear enough.

    When handling the NRF_BLE_AMT_C_EVT_NOTIFICATION event in amtc_evt_handler(..) in main.c, I was expecting to see an array of received bytes or a pointer to the received bytes in the p_evt ->params.hvx structure. I however only see the number of received bytes (bytes_rcvd), not the bytes themselves or a pointer to them.

    I assume I'm missing something. Therefore my question is how I can retrieve the received bytes, either in this event handler or in on_hvx(..), or anywhere else.

    Best regards,

    Luc

  • Hi Luc

    Thanks for the clarification. 

    Apparently the data pointer is not forwarded to the application event handler. I wasn't aware of this myself to be honest, but since this example is intended to measure the transfer speed, and doesn't really care about the data content, I expect that to be the reason. 

    If you want to change this behavior you need to modify the amtc.c/h implementation and add another field to the amtc event structure. 

    In the on_hvx(..) function in amtc.c you can access the notification data through the p_ble_evt->evt.gattc_evt.params.hvx.data pointer, and if you extend the amtc event you can forward this pointer to the application so that the data can be processed. 

    Best regards
    Torbjørn

  • Hi Torbjørn,

    This is great support! I got it working quickly, thanks.

    Best regards,

    Luc

Reply Children
Related