Good Day.
I get an MPU FAULT when creating a new thread where I want to display the RSSI value.
Looking at similar requests in the community, there were recommendations to increase CONFIG_MAIN_STACK_SIZE, I increased this parameter to 2048, but it didn't help.
I have one thread (Priority = 7) in my program now (taken from the BLE example), it sends data over bluetooth.
void send_data_thread(void) { while (1) { /* Simulate data */ simulate_data(); /* Send notification, the function sends notifications only if a client is subscribed */ my_lbs_send_sensor_notify(app_sensor_value); k_sleep(K_MSEC(NOTIFY_INTERVAL)); } } K_THREAD_DEFINE(send_data_thread_id, 2048, send_data_thread, NULL, NULL, NULL, 7, 0, 0);
When adding a second thread (Priority = 8) that should read RSSI, an error occurs.
void rssi_thread(void) { int8_t rssi = 0xFF; while(1){ read_conn_rssi(default_conn_handle, &rssi); LOG_INF("RSSI level = %d\n", rssi); k_msleep(1000); } } K_THREAD_DEFINE(rssi_thread_id, 2048, rssi_thread, NULL, NULL, NULL, 8, 0, 0);
If I move all the code from rssi_thread() to main(), everything works without errors.
Can you please tell me what could be the reason?
Thanks.