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

Write to Cypress peripheral from nRF52840 fails

Hello,

I am writing a single byte value to a cypress module using write with response (BLE_GATT_OP_WRITE_REQ). For some reason the peripheral will receive the value but will not carry out the action I expect as a result of the write. When I do the write from the nRF connect app, the peripheral receives the byte and actions accordingly.

BLE_GATT_OP_WRITE_CMD returns invalid op so I think it needs to be a write with response. Does anyone have any idea why this would be the case?

What could the nRF app be doing that I am not when carrying out this simple write?

Thanks in advance for any help!

Lewis.

Parents
  • HI Lewis, 

    Could you try to capture a sniffer trace of the communication ? You only need a NRF52 DK to use as a sniffer.  With that we can see the difference when you do a write request from the nRF52840 and when you do write request from nRF Connect. 

    Could you explain what exactly  you meant by "but will not carry out the action I expect as a result of the write." What exactly missing ? Did you receive the event BLE_GATTC_EVT_WRITE_RSP ?

  • Hi Hung Bui,

    I am waiting for a sniffer I have ordered to arrive as currently I do not have one. It should be with me in the next day or so and I will update then.

    The Cypress module (peripheral) is attached to a servo and moves in response to a characteristic value being written to. It is a production item and I know there is nothing wrong with this side of things. As proof, things happen as I expect when using the mobile apps (nRF connect, BLE Hero, CySmart etc...). 

    When I write to the same characteristic from my Adafruit nRF52 feather, I do indeed receive the BLE_GATTC_EVT_WRITE_RSP  along with a GATT_SUCCESS. When I then check the value of the characteristic, it has indeed changed. BUT for some reason the servo does not move UNLESS I disconnect the two devices and then re-connect.

    Is there anything you can think of that would cause this behaviour? It feels like a connection event is not terminating?

    Thank you


    Lewis

Reply
  • Hi Hung Bui,

    I am waiting for a sniffer I have ordered to arrive as currently I do not have one. It should be with me in the next day or so and I will update then.

    The Cypress module (peripheral) is attached to a servo and moves in response to a characteristic value being written to. It is a production item and I know there is nothing wrong with this side of things. As proof, things happen as I expect when using the mobile apps (nRF connect, BLE Hero, CySmart etc...). 

    When I write to the same characteristic from my Adafruit nRF52 feather, I do indeed receive the BLE_GATTC_EVT_WRITE_RSP  along with a GATT_SUCCESS. When I then check the value of the characteristic, it has indeed changed. BUT for some reason the servo does not move UNLESS I disconnect the two devices and then re-connect.

    Is there anything you can think of that would cause this behaviour? It feels like a connection event is not terminating?

    Thank you


    Lewis

Children
  • Hi Lewis, 
    We need to compare the sniffer trace of the comm from the phone and the trace from the Adafruit module to really tell what caused the issue. 
    If you received the BLE_GATTC_EVT_WRITE_RSP with SUCCESS then I think it has something to do with the servo. 
    There is a possibility that you must enable CCCD or need to write in a certain sequence to make the servo work as it should.

    But you mentioned "BUT for some reason the servo does not move UNLESS I disconnect the two devices and then re-connect." did you mean that after you disconnect and reconnect everything works fine even with the Adafruit ? 

Related