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

S120 unable to receive data larger than 1 byte?

Hello Nordevzone:

8.0 multilink example

I tried to use this modified handler to receive notification data from a s110 based application. The centerpiece of the handler is to read the value of this member:

p_ble_evt->evt.gattc_evt.params.hvx.data[i]

And the function is:

    static void on_evt_hvx(ble_evt_t * p_ble_evt, client_t * p_client, uint32_t index)
{
    int i;
	if ((p_client != NULL) && (p_client->state == STATE_RUNNING))
    {
        if (
                (
                        p_ble_evt->evt.gattc_evt.params.hvx.handle
                        ==
                                p_client->srv_db.services[0].charateristics[p_client->char_index].characteristic.handle_value
                )
                
        )
        {


				for(i=0;i<=7;i++)
			{
			
			
			
			
				  printf ("%x",p_ble_evt->evt.gattc_evt.params.hvx.data[i]);
			

				nrf_delay_ms(500);
				
			}
					 
		

        }
    }
}

When I try to receive only 1 byte, everything was fine. But when I try to send 8 bytes as shown in this function, instead of the proper content I programmed in the s110 application, I get random numbers as the printf result. I wasn't able to tell if the "sending" function of my s110 application worked correctly i.e. it send anything over the radio at all, or it's just that the s120 function as shown above failed to correctly receive those data.

Anyhow, I don't know which direction to go on. Can someone please kindly help me? Enlighten me a bit on where to proceed next.

Thanks in advance.

  • I would strongly not recommend to have a delay of 500ms (nrf_delay_ms(500)) inside this function as it is called in interrupt context. Can you try to remove it?

  • Thank you Ole, I'll try that. But I really doubt it will mean anything since the delay function won't be called unless data was received?

  • What numbers do you expect and what numbers do you get? %x means that the numbers will be printed out in hex format. Can you print out on the peripheral side also just before sending and see if the numbers correspond? If it does print out something, that should mean that the printf is called?

  • I was expecting a string of 1 to 8. I got random numbers that doesn't amount to anything at all, not even incremental.

    I'll check the s110 device side to see if all data were properly sent. Thanks Ole.

    Erik