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

NRF_CLOUD_EVT_RX_DATA

I have programmed a Nordic Thingy 91 with lte_ble_gateway, and when I send command from the cloud to the device, an NRF_CLOUD_EVT_RX_DATA event is called, however evt->param.data.ptr returns (null). 

Can anyone tell me why no data are passed from the cloud to the device?

I have tried the same program with nRF9160 and I can see the data I have sent. 

Please assist 

Parents
  • Hello, 

    When posting a support ticket it would be great if you can provide as much information as possible. Can you please provide some more information regarding your setup? What version of NCS are you using? The lte_ble_gateway is not designed for the Thingy:91, only nRF9160 DK according to the documentation. Can you please elaborate on what you have done?

    Thanks!

    Kind regards,
    Øyvind

  • Dear Øyvind, 

    lte_ble_gateway can be used with Thingy:91 according to this 

    https://devzone.nordicsemi.com/f/nordic-q-a/52689/nrf9160-lte-sensor-gateway-on-thingy-91/225659#225659

    I have loaded the program to the thingy91 and it is working fine. The only problem I am encountering now is the when i send data using using REST API provided, the message does reach the thingy91 as the NRF_CLOUD_EVT_RX_DATA event flag is raised. 

    however when i look into the data received by running these two commands 

    snprintf(s0, sizeof(s0), "%s", evt->param.data.ptr);
    printk("S0 is %s \n", s0);

    my output is 

    S0 is (null)

    I was expecting to see whatever i have sent to be displayed here but it is not, why?

    I am using nRF Connect SDK v1.1.0 

  • Hello ,

    I'm sorry, but under case NRF_CLOUD_EVT_RX_DATA (nrf\subsys\net\lib\nrf_cloud\src\nrf_cloud.c) the only thing I can find is:

    case NRF_CLOUD_EVT_RX_DATA:
    		LOG_DBG("NRF_CLOUD_EVT_RX_DATA");
    
    		evt.type = CLOUD_EVT_DATA_RECEIVED;
    		evt.data.msg.buf = (char *)nrf_cloud_evt->data.ptr;
    		evt.data.msg.len = nrf_cloud_evt->data.len;
    
    		cloud_notify_event(nrf_cloud_backend, &evt, config->user_data);
    		break;

    Have you edited the NRF_CLOUD_EVT_RX_DATA event in any way?  I am not able to find evt->param.data.ptr in NCS v1.1.0. If you have added it yourself, are you certain that it is of type string? Please provide more information. 

    Kind regards,
    Øyvind

  • Dear Øyvind, 

    I am not sure why you went there anyway, 

    this is the code from the main file

    /**@brief Callback for nRF Cloud events. */
    static void cloud_event_handler(const struct nrf_cloud_evt *evt)
    {
    	int err;
    
    	switch (evt->type) {
    	case NRF_CLOUD_EVT_TRANSPORT_CONNECTED:
    		printk("NRF_CLOUD_EVT_TRANSPORT_CONNECTED\n");
    		break;
    	case NRF_CLOUD_EVT_USER_ASSOCIATION_REQUEST:
    		printk("NRF_CLOUD_EVT_USER_ASSOCIATION_REQUEST\n");
    		on_user_association_req(evt);
    		break;
    	case NRF_CLOUD_EVT_USER_ASSOCIATED:
    		printk("NRF_CLOUD_EVT_USER_ASSOCIATED\n");
    		break;
    	case NRF_CLOUD_EVT_READY:
    		printk("NRF_CLOUD_EVT_READY\n");
    		display_state = LEDS_PAIRED;
    		struct nrf_cloud_sa_param param = {
    			.sensor_type = NRF_CLOUD_SENSOR_TEMP,
    		};
    
    		err = nrf_cloud_sensor_attach(&param);
    
    		if (err) {
    			printk("nrf_cloud_sensor_attach failed: %d\n", err);
    			nrf_cloud_error_handler(err);
    		}
    
                    param.sensor_type = NRF_CLOUD_SENSOR_HUMID,
    
    		err = nrf_cloud_sensor_attach(&param);
    
    		if (err) {
    			printk("nrf_cloud_sensor_attach failed: %d\n", err);
    			nrf_cloud_error_handler(err);
    		}
    
    		atomic_set(&send_data_enable, 1);
    		break;
    	case NRF_CLOUD_EVT_SENSOR_ATTACHED:
    		printk("NRF_CLOUD_EVT_SENSOR_ATTACHED\n");
    		break;
    	case NRF_CLOUD_EVT_SENSOR_DATA_ACK:
    		printk("NRF_CLOUD_EVT_SENSOR_DATA_ACK\n");
    		break;
    	case NRF_CLOUD_EVT_TRANSPORT_DISCONNECTED:
    		printk("NRF_CLOUD_EVT_TRANSPORT_DISCONNECTED\n");
    		atomic_set(&send_data_enable, 0);
    		display_state = LEDS_INITIALIZING;
    
    		/* Reconnect to nRF Cloud. */
    		k_work_submit(&connect_work);
    		break;
    	case NRF_CLOUD_EVT_ERROR:
    		printk("NRF_CLOUD_EVT_ERROR, status: %d\n", evt->status);
    		atomic_set(&send_data_enable, 0);
    		display_state = LEDS_ERROR;
    		nrf_cloud_error_handler(evt->status);
    		break;
            case NRF_CLOUD_EVT_RX_DATA:
    		printk("NRF_CLOUD_EVT_RX_DATA\n");
    		//on_data_received(evt);
            snprintf(s0, sizeof(s0), "%s", evt->param.data.ptr);
            printk("S0 is %s \n", s0);
    		break;
    	default:
    		printk("Received unknown event %d\n", evt->type);
    		break;
    	}
    }

    the nrf_cloud_evt data sturcture is described in nrf_clud.h

    my question still remain, why is the data return (null)

Reply Children
No Data
Related