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

HTTP POST with NCS v1.0.0-rc4

Dear

I just tried to run LTE-M/HTTP POST with NCS v1.0.0-rc4 (with nrf git fetch origin pull/943/head:branch1)

but, I COULD NOT POST any more:

**** Booting Zephyr OS build v1.14.99-ncs2-rc4-495-ga8933a2ead01 *****
LTETESTING is starting 
 LTE is connecting........... 
Checking LTE_M signal.............

+COPS: 0,2,"24201",7

OK

OK

+CEREG: 2,1,"765D","0110C303",7

OK


Original String is: +CEREG: 2,1,"765D","0110C303",7

OK

Found the LTE_M signal 
Closing socket

  find LTE_M signal........... 
***** USAGE FAULT *****
  Illegal load of EXC_RETURN into PC
***** Hardware exception *****
Current thread ID = 0x200203a8
Faulting instruction address = 0x0
Fatal fault in thread 0x200203a8! Aborting.
Exception occurred in Secure State
***** HARD FAULT *****
  Fault escalation (see below)
***** BUS FAULT *****
  Precise data bus error
  BFAR Address: 0x50008120
***** Hardware exception *****
Current thread ID = 0x20021ae4
Faulting instruction address = 0x21992
Fatal fault in ISR! Spinning...

It worked normal with the old version v0.4.0

1. when i used the same setup, i got error: 

1> zephyr/subsys/net/ip/libsubsys__net__ip.a(net_if.c.obj): In function `net_if_ipv6_calc_reachable_time':
1> D:/hng/projects/CyCollector/ncs_v1.0.0_rc4/zephyr/subsys/net/ip/net_if.c:2067: undefined reference to `sys_rand32_get'
1> collect2.exe: error: ld returned 1 exit status

2. I added the option: 

# Disable native network stack to save some memory
CONFIG_NET_IPV4=n
CONFIG_NET_IPV6=n

then, Build Solution: Build completed

but, I got the error 

My code:

LTE_M_NB-IoT.7z

Thanks so much

Regards, 

hng

Parents
  • I was able to post to a webserver, with ncs v1.0.0 and modem v1.0.0. Could you test my attached example?

    http_post.zip

    Best regards,

    Simon

  • Hi @Simon

    Thanks so much, I just backed from vocation, I will try your suggestion and contact with you soon

    Mvh, 

    Hoang Nguyen 

  • Dear Simon, 

    Ja, it works, but I got another "funny" error ( because I dont know why!!!) 

    I removed: 

    printk("Hello from start of main");
         char tmp_str[MAXLINE + 1];
         snprintf(tmp_str,500,
    		"$GPGGA,%02d%02d%02d.200,%8.3f,N,%09.3f,W,1," 
    		"12,1.0,0.0,M,0.0,M,,*", 2019, 07, 23, 59.3033, 10.454);
         //printf("tmp_string is: %s \n",tmp_str); 
         

    and just ran:

    int main(void){
    
         printk("Hello from start of main \n");
         char send_buf[MAXLINE + 1];
         int send_data_len_post = snprintk(send_buf,
                                             500,
    				         POST_TEMPLATE, HTTP_PATH,
    				         HTTP_HOST, strlen(TEST_STRING),
    				         TEST_STRING);
    
         printf("send_buf is: %s \n",send_buf);
         printk("send err: %d\n\r", send_data_len_post);
        
         //snprintk_post("OMG whyyyyyyyyyyyy \n"); 
         while (1) {
              //5 seconds delay
              k_sleep(5000);
              
              }
       }

    it didnt work:

    SPM: NS image at 0xc000
    SPM: NS MSP at 0x20024cf8
    SPM: NS reset vector at 0xec1d
    SPM: prepare to jump to Non-Secure image.
    ***** Booting Zephyr OS v1.14.99-ncs2 *****
    Hello from start of main %
    ***** USAGE FAULT *****
      Illegal use of the EPSR
    ***** Hardware exception *****
    Current thread ID = 0x20021e9c
    Faulting instruction address = 0xec1c
    Fatal fault in essential thread! Spinning...
    

    then, I tried to add an extra variable (but i will not use it !!!!)

    char tmp[MAXLINE + 1];

    and, it works:

    SPM: NS image at 0xc000
    SPM: NS MSP at 0x20024cf8
    SPM: NS reset vector at 0xec1d
    SPM: prepare to jump to Non-Secure image.
    ***** Booting Zephyr OS v1.14.99-ncs2 *****
    Hello from start of main 
    send_buf is: POST /? HTTP/1.1
    
    Host: 142.93.37.192
    
    Connection: keep-alive
    
    Content-type: application/x-www-form-urlencoded
    
    Content-length: 19
    
    
    
    111 from nRF9160 DK 
    send err: 153
    

    I dont know why!!!????

    Thanks,

    mvh

    Hoang 

  • I am sorry for the delay. The support staff is reduced during the summer holidays, and you may experience delayed answers. Have you been able to resolve this issue?

    Best regards,

    Simon

  • Hi Simon, 

    I understand it, not yet Disappointed

    Mvh

    Hoang

  • Hmm.. That is really strange. I was able to recreate the error message. I tried to minimize the project to try to locate the problem, and I eventually ended up with the following project, which was giving the same error:

    #include <zephyr.h>
    #include <net/socket.h>
    #include <stdio.h>
    
    int main(void)
    {
         //char tmp_str2[2];
         char send_buf[4096];
    
         while (1) {
              
              }
    	
    }

    However, if I set CONFIG_SIZE_OPTIMIZATION=y (and removed the optimize nothing config), then it worked fine. 

    I will report the problem internally. In the mean time, I guess you have to declare tmp_str as a temporary solution.

    Best regards,

    Simon

  • The solution to this is to set CONFIG_NO_OPTIMIZATIONS to y, and increase the main stack size through CONFIG_MAIN_STACK_SIZE or place it in the data section instead of on the stack by declaring and initializing it outside of the main function.

    Best regards,

    Simon

Reply Children
No Data
Related