Hello
I am using SDK v17 and nRF52DK board (PCA10040) and testing mpu6050 sensor.
I want to print out the sensor value through the app through ble_app_uart.
Before sending the sensor values through the app, I would like to test the output at the terminal.
However, there is a problem merging to the ble_app_uart code.
Bluetooth connections work well, but debugging will cause 'NRF_BREKPOINT_COND;'error. Printed at 'err_code = app_mpu_read_accel (& accel_values)
//mpu6050
void mpu_init(void)
{
ret_code_t ret_code;
// Initiate MPU driver
ret_code = app_mpu_init();
APP_ERROR_CHECK(ret_code); // Check for errors in return value
// Setup and configure the MPU with intial values
app_mpu_config_t p_mpu_config = MPU_DEFAULT_CONFIG(); // Load default values
p_mpu_config.smplrt_div = 19; // Change sampelrate. Sample Rate = Gyroscope Output Rate / (1 + SMPLRT_DIV). 19 gives a sample rate of 50Hz
p_mpu_config.accel_config.afs_sel = AFS_2G; // Set accelerometer full scale range to 2G
p_mpu_config.gyro_config.fs_sel = AFS_2G;
ret_code = app_mpu_config(&p_mpu_config); // Configure the MPU with above values
APP_ERROR_CHECK(ret_code); // Check for errors in return value
}
int main(void)
{
bool erase_bonds;
uint32_t err_code;
// Initialize.
uart_init();
log_init();
timers_init();
buttons_leds_init(&erase_bonds);
power_management_init();
ble_stack_init();
gap_params_init();
gatt_init();
services_init();
advertising_init();
conn_params_init();
mpu_init(); //add
// Start execution.
printf("\r\nUART started.\r\n");
NRF_LOG_INFO("Debug logging for UART over RTT started.");
advertising_start();
accel_values_t accel_values; //mpu6050
gyro_values_t gyro_values;
// Enter main loop.
for (;;)
{
idle_state_handle(); //sleep mode
//MPU6050 CODE
if (NRF_LOG_PROCESS() == false)
{
//app_mpu_read_accel(&accel_values);
//app_mpu_read_gyro(&gyro_values);
err_code = app_mpu_read_accel(&accel_values);
APP_ERROR_CHECK(err_code);
//err_code = app_mpu_read_gyro(&gyro_values);
//APP_ERROR_CHECK(err_code);
//Accel value
NRF_LOG_INFO("Accel_X : "NRF_LOG_FLOAT_MARKER"", NRF_LOG_FLOAT(accel_x)); //float print
NRF_LOG_INFO("Accel_Y : "NRF_LOG_FLOAT_MARKER"", NRF_LOG_FLOAT(accel_y));
NRF_LOG_INFO("Accel_Z : "NRF_LOG_FLOAT_MARKER"", NRF_LOG_FLOAT(accel_z));
nrf_delay_ms(500);
//start_accel_update_flag = false;
}
}
}
3480.ble_app_uart.zip3312.mpu6050.zip
I attached the project because there may be a problem with other parts.
The mpu6050 was placed in the \nRF5_SDK_17.0.0_9d13099\examples path.
Can you tell me the problem?
Thank you in advance.