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

APP_UART_DATA_READY reset nRF52832

Hi, I am a beginner programmer and I have the next problem.

I am working with nRF52832 SDK 12.2 trying to send AT commands to an ESP8266. I send the AT commands byte by byte through UART which I managed with APP_UART_TX_EMPTY. Then I receive the ESP8266 response in APP_UART_DATA_READY and when I should get a response such as \r\nOK\r\n I get half data instead. When it happens the nRF52 resets. The ESP8266 is working rigth because I check the response with a terminal so I think I could be a problem with UART. Any help will be appreciated.

Thanks in advance

Parents Reply Children
  • I haven't had a solution yet. I have debug and get the reset reason 0x00000004. Here it is my uart_event_handle() :

    void uart_wifi_event_handle(app_uart_evt_t * p_event) { static uint8_t data_wifi_array; uint32_t err_code;

    switch (p_event->evt_type)
    {
    		
    		case APP_UART_DATA_READY:
    				
    		UNUSED_VARIABLE(app_uart_get(&data_wifi_array));
    		
    		
    		if(ind_datawifi_uart == 0)
    			{
    				if(data_wifi_array == 0x0D)
    					{
    					startreadwifiUART=true;
    					memset(cmd_wifi_buff,0,UART_TX_BUF_SIZE);
    					}
    			}
    				
    			if (startreadwifiUART)
    				{
    					cmd_wifi_buff[ind_datawifi_uart]=data_wifi_array;
    					ind_datawifi_uart++;
                                         }
    
        break;
    			
    			case APP_UART_TX_EMPTY:
    				if(wlenps > 0)
    				{	
    					err_code = app_uart_put(stringwifi[windps]);
    					APP_ERROR_CHECK(err_code);
    					windps++;
    				}
    			break;
    
        default:
    				
            break;
    			}
    	}
    

    }

    Where I sent AT commands through APP_UART_TX_EMPTY and I should get the completely response on APP_UART_DATA_READY.

  • I assume you have the global

    uint8_t cmd_wifi_buff[UART_TX_BUF_SIZE];

    defined in some other c module correct?

    Is it possible to run the app_uart_put() in your main() program instead of inside the uart_event_handle()? Just try this quick test and let us know how it goes.

  • Yes Matt, it is already defined. Unless I run app_uart_put() inside the uart_event_handle() I just get the first byte of AT commands.

    Thanks

  • But how would you stop sending the AT command? i.e. when would wlenps become 0? Can you try this in the main()

        char stringwifi[] = "<put your AT cmd here...>";
    for (uint16_t i = 0; i < strlen(stringwifi); i++)
    {
    	while(app_uart_put(stringwifi[i]) != NRF_SUCCESS);
    }
    
Related