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

nRF UART app not detecting

Hi, I have tested a sample code which sends some data through BLE in nRF52 development kit(PCA10400). The code is attached below.

nRF5_SDK_11.0.0_MPU6050_Acc_X_Output.7z

I was able to connect the nRF UART app with the nRF DK and could send data to the app. The app could also send data and was displayed in terminal.

Later I tried to program a BMD-300 module which is attached on an external board.I followed some steps to program the external module but couldn't succeed. I tried to do the same commands in the onboard nRF52 module and everything executed successfully. But from then the sample program which I atttached is not executing at all. Neither the iPhone's Bluetooth nor nRF UART app no longer detecting the device for this particular code. But the basic ble_app_uart code which comes along with the SDK is working. I haven't done any changes to the code. Does the nRFjprog commands changed anything in the chip? or Is there any settings I need to check in Keil?

There is one more code which is showing the same problem. nRF52-ADC-examples-master.zip This was also working previously, but not working now. Any help would be appreciated.

Thanks, Vishnu

  • I see that you have added this code to the main.c:

                MPU6050_GetAccData(MPU6050_Acc);
    	        memset(PrintBuffer,0x00,sizeof(PrintBuffer));
    			sprintf(PrintBuffer, "x:%.2f\r\n", MPU6050_Acc[0]);	//show x-axis rawdata
    			length = strlen(PrintBuffer);
    			err_code = ble_nus_string_send(&m_nus, PrintBuffer, length);
    			nrf_delay_ms(1000);
    

    Can you add APP_ERROR_CHECK(err_code); on the error_code from ble_nus_string_send(), and see if you get an error. When sending data on every main iteration, you are also maybe filling the BLE buffers, and getting a BLE_ERROR_NO_TX_BUFFERS error ? Try to only send data when you get new data from the MPU6050.

  • How can I check the err_code value? Sorry if the question is too stupid to ask. I haven't succeeded in debugging the device yet using Keil. How can I do that?

    The device is not sending to the PC's terminal also through UART. I updated the main code to just send some sample String. it is given below

    1. Set optimization level 0 in target options -> C/C++ and define DEBUG in the preprocessor symbols.
    2. Place a break point next to while(loop) line 119, in app_error.c
    3. What for the error to happen, and read the value.
  • int main(void) { uint32_t err_code; bool erase_bonds; uint16_t length = 0; // Initialize. // MPU6050_Init(); APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false); uart_init();

    buttons_leds_init(&erase_bonds);
    ble_stack_init();
    gap_params_init();
    services_init();
    advertising_init();
    conn_params_init();
    	
    printf("\r\nUART Start!\r\n");
    err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
    APP_ERROR_CHECK(err_code);
    
    // Enter main loop.
    for (;;)
    {
    		//	MPU6050_GetAccData(MPU6050_Acc);
    		//	memset(PrintBuffer,0x00,sizeof(PrintBuffer));
    		//	sprintf(PrintBuffer, "x:%.2f\r\n", MPU6050_Acc[0]);	//show x-axis rawdata
    		//	length = strlen(PrintBuffer);
    			err_code = ble_nus_string_send(&m_nus, "Testing", 7);
    			APP_ERROR_CHECK(err_code);
    			nrf_delay_ms(1000);
        power_manage();
    }
    

    }

  • Hi Sigurd, It is not coming into the breakpoint. Can you just check the code whether it is detecting in your mobile phone or not?

Related