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

GPS/LTE_M/NB-IoT nRF91

Dear, 

I am using :

ncs: v0.4.0 

SES 4.16 

firmware: mfwnrf916007029alpha

Hardware: nRF9160 DK v: 0.8.5

I want to do: 

1. Enable and get GPS position ("AT\%XSYSTEMMODE=0,0,1,0") and data from BMP280 sensor  --> store it in data_pack

2. Turnoff GPS and Enable LTE_M: ("AT\%XSYSTEMMODE=1,0,0,0") & use HTTP POST to post data_pack to my webserver 

3. Switch to NB-IoT: ("AT\%XSYSTEMMODE=0,1,0,0") & use HTTP POST to post data_pack to my webserver

Is it posiblie to do like that now?

I know: "The current modem firmware, v0.7.0-29-alpha, allows you to choose the system mode via command %XSYSTEMMODE, but it does not support them concurrently, meaning that you cannot have GPS + NB-IoT, or GPS + CAT M1, enabled simultaneously at this time."  https://devzone.nordicsemi.com/f/nordic-q-a/48077/gps-http-post

I can switch: AT\%XSYSTEMMODE=0,0,1,0/AT\%XSYSTEMMODE=1,0,0,0/AT\%XSYSTEMMODE=0,1,0,0 but I couldn't POST data to my webserver.

Do you have any suggestions?

Thanks,

Regards, 

hng

Parents
  • Hi hng,

     

    I am very sorry for not seeing the last post in the linked case.

    The system has a flaw when you accept an answer, then add a new reply, it will still mark the case as resolved, so I do not get a notification or state-change on that topic, unfortunately.

     

    From the last reply, it seems that you are not able to successfully connect over NB-IoT in your area, as you do not get the Cell ID, MCC, MNC, and other registration information. You could try to ask your local network providers if there's a nb-iot coverage issue in your area.

    Cat M1 still works fine, right?

     

    Kind regards,

    Håkon

  • Dear

    Thats ok Håkon. 

    I verified the NB-IoT in Horten, Vestfold with iBasis: NO. Then, I used another sim card (telia), I got NB-IoT signal but no LTE-M. I will find someone else, can supply both LTE-M and NB-IoT. 

    But, what do you think about my plan: 

    I want to do: 

    1. Enable and get GPS position ("AT\%XSYSTEMMODE=0,0,1,0") and data from BMP280 sensor  --> store it in data_pack

    2. Turnoff GPS and Enable LTE_M: ("AT\%XSYSTEMMODE=1,0,0,0") & use HTTP POST to post data_pack to my webserver 

    3. Switch to NB-IoT: ("AT\%XSYSTEMMODE=0,1,0,0") & use HTTP POST to post data_pack to my webserver

    Is it possible to do like that now?

    Regards,

    hng

  • Hi,

     

    Your code prints "client_fd: -1", which indicates that the socket is not allocated. Looking through the code, it seems that you do not close your sockets after you're done, for instance in nRF_offGPS_onLTE. For every created socket(), there should be a corresponding close(). This also goes for the getaddrinfo(), which should also have a corresponding freeaddrinfo() within the same scope.

     

    Kind regards,

    Håkon

  • Dear

    Thanks so much

    I could  :

    (1) GPS position

    (2) LTE-M connection 

    (3) http post with LTE-M to my webserver

    I tried to release the LTE-M socket() after posting and run loop (1)-(2)-(3) again. But, I couldn't connect to gps socket again.

    void app_http_post(char *PostString)
    {  
    	//int err; 
            printk("Sending data to webserver\n");
            struct sockaddr_in local_addr;
    	struct addrinfo *res;
    
    	local_addr.sin_family = AF_INET;
    	local_addr.sin_port = htons(0);
    	local_addr.sin_addr.s_addr = 0;
    
    	    
    	int err = getaddrinfo(HTTP_HOST, NULL, NULL, &res);
    
    	printk("getaddrinfo err: %d\n\r", err);
    	((struct sockaddr_in *)res->ai_addr)->sin_port = htons(HTTP_PORT);
            
            char send_buf[MAXLINE + 1];
    	int send_data_len_post = snprintf(send_buf,
    				         500, /*total length should not exceed MTU size*/
    				         POST_TEMPLATE, HTTP_PATH,
    				         HTTP_HOST, strlen(PostString),
    				         PostString);
    
    	printk("send err: %d\n\r", send_data_len_post);
    	int client_fd = socket(AF_INET, SOCK_STREAM, 0);
    	printk("client_fd: %d\n\r", client_fd);
    	err = bind(client_fd, (struct sockaddr *)&local_addr, sizeof(local_addr));
    	printk("bind err: %d\n\r", err);
           	err = blocking_connect(client_fd, (struct sockaddr *)res->ai_addr,sizeof(struct sockaddr_in));
    	printk("connect err: %d\n\r", err);
            int numbytes = blocking_send(client_fd, send_buf, send_data_len_post, 0);
            printk("send err: %d\n\r", numbytes);
    
            freeaddrinfo(res); // free getaddrinfo(HTTP_HOST, NULL, NULL, &res);
            k_sleep(1000);
            printk("Close socket \n\r");
           	close(client_fd); // close the socket
           
       
    }

    and : lte_lc_offline(); 

    but, I couldnt connect to GPS socket 

    fd = nrf_socket(NRF_AF_LOCAL, NRF_SOCK_DGRAM, NRF_PROTO_GNSS);

    the source code: 

    GPS_LTE_June25.7z

    The second time, it will return: 

    Could not init socket (err: -1)

    Thanks, 

    Regards, 

  • Hi hng,

     

    We have an issue when switching back and forth several times in the current modem fw v0.7.0-29. We have reported this internally to our designers and developers, and they are working on fixing this issue.

     

    Kind regards,

    Håkon

  • Dear

    Thanks so much, 

    I hope you can fix it in the next fw version. 

    Regards

    hng

  • It is our intention to fix this soon.

    Sorry for the inconvenience.

     

    Kind regards,

    Håkon

Reply Children
Related