Hi ,
I am working Da14531 by interfacing pressure sensor over I2C, Observations
- We are using BLE_Peripheral application.
- Intension is to read the data from sensor vial I2C and send it to mobile app over BLE.
- Now we can able to read the data and sent it over BLE.
- But When i disconnect from mobile phone Da14531 is going into hard error state.
- To work it as normal again have to power off and power On the device , then it will conne6472.DA145xx_SDK_TPMS.zipct and sends the data.
- If disconnect , then device wont advertise please suggest. attached code and screen shot for your reference.
assert_warning ERROR ITS SHOWING.
Thanks in advance
PSk
Hi PSK,Thank you for posting your question online.Let me check on this and I will get back to you as soon as possible.P.S.I moved this thread to the BLE forum since this is not Wi-Fi related.Best Regards,OV_Renesas
Hi PSK,I compiled and tried to run the project but it is not advertising on my side. I believe is due the fact that I do not have any sensor connected to the I2C pins.I am not able to recreate your error.However, I saw that you have modified the main function which is part of the SDK folders. You should not modify the SDK folders, you should be able to create your application only on the user folders:
int main(void) { sleep_mode_t sleep_mode; // initialize retention mode init_retention_mode(); //global initialise system_init(); /* ************************************************************************************ * Platform initialization ************************************************************************************ */ while(1) { i2c_slave_receive_transmit(); //call i2c function do { // schedule all pending events schedule_while_ble_on(); } while (app_asynch_proc() != GOTO_SLEEP); //grant control to the application, try to go to power down ....
Hi,
Error is showing at below file.
PSK
If i remove i2c_slave_receive_transmit(); from main can able to Advertise, Connect and disconnect properly but unable to get the data of sensor on mobile App. If i put i2c_slave_receive_transmit(); in main can able to read the sensor values on app, Could you please suggest , Where i can add above function so that i can get the values on App.
Hi PSK,Thank you for the replies.Regarding the 1st Screenshot:It looks like a HardFault Exception. Please refer on 3. Analyzing Hard-Fault — SDK6 Debugging Tutorial (renesas.com), you should be able to pinpoint where exactly the code "crash" so we can get a better understanding.Regarding the 2nd Screenshot:It looks like an app_easy_timer was not handled correctly and it crashed. Please make sure that you Initialize the Timers whenever you want to use them and make sure to stop/cancel them when they are not meant to work any more. Which error occurs first?
pk said:If i remove i2c_slave_receive_transmit(); from main can able to Advertise, Connect and disconnect properly but unable to get the data of sensor on mobile App. If i put i2c_slave_receive_transmit(); in main can able to read the sensor values on app, Could you please suggest , Where i can add above function so that i can get the values on App.
From the project you have shared, I can see that the i2c_slave_receive_transmit() is being called only in the following function:
/************sending pressure, accelerometer, voltage and temperature in mobile through BLE************/ void user_svc1_adc_val_1_cfg_ind_handler(ke_msg_id_t const msgid, struct custs1_val_write_ind const *param, ke_task_id_t const dest_id, ke_task_id_t const src_id) { struct custs1_val_ntf_ind_req *req = KE_MSG_ALLOC_DYN(CUSTS1_VAL_NTF_REQ, prf_get_task_from_id(TASK_ID_CUSTS1), TASK_APP, custs1_val_ntf_ind_req, DEF_SVC1_ADC_VAL_1_CHAR_LEN); sprintf(a,"p=%d,x=%d,z=%d,t=%d",pressure1,accel_x1,accel_z1,temp); // req->conhdl = app_env->conhdl; req->handle = SVC1_IDX_ADC_VAL_1_VAL; req->length = DEF_SVC1_ADC_VAL_1_CHAR_LEN; req->notification = true; memcpy(req->value, &a, DEF_SVC1_ADC_VAL_1_CHAR_LEN); ke_msg_send(req); if (ke_state_get(TASK_APP) == APP_CONNECTED) { wkupct_register_callback(i2c_slave_receive_transmit); i2c_slave_receive_transmit(); } }
Case 1:
- Earlier i had defined the i2c_slave_receive_transmit(); in main(below screen shot) that time it was advertising and after pairing we were able to receive sensor data.
- But after disconnection device would stop advertising and for advertising again i need to to do power on reset .
Case 2:
- Have commented i2c_slave_receive_transmit(); in main and added in user app connection,.
- In this case device advertising, connection and disconnection working properly but sensor is unable read the values , please find below screen shots.
Suggest.
Hi PSK,Thank you for the reply.Please give us some information regarding the screenshot errors you mentioned earlier. The issue you are facing now is most probably related to those errors. After that, please give us a high level explanation of your application in bullets so we can understand what you are trying to accomplish. After that we can help you on where the I2C operation should be placed so it would work inside the SDK6.Best Regards,OV_Renesas
Case: When i put i2c slave_recieve_transmi() in main
- I will flash the code on module , device starts advertising and will connect with nRF connect app and enable notificarion services.
- I can able to read the data.
- Now i will disconnect and try connecting again, During that period code stops at below point.
No my requirement is.
- I have interfaced DA14531 module with pressure senor over I2C.
- Whenever DA14531 module power ON , It will read the data from sensor and when i pair it with nRf connect app, It should send the data to app at every 1minute and should go back again to sleep mode.
- According have developed the firmware but its throwing above error.
Hi PSK,Thank you for the reply.Regarding the screenshot error:As you can see on the screenshot, the error is due to an app_easy_timer. After checking the code, I have reasons to believe it is due to ADC_Timer. You start ADC_Timer on the user_app_adv_start callback function by calling the print_adc function.Every 2 seconds you are going to read the ADC value and print it on the Terminal. When a connection has been terminated, the user_app_disconnect custom callback function will be executed. There, you cancel the ADC_Timer but you call again the user_app_adv_start to restart advertising:You will end up on the print_adc function, but the ADC_Timer is not initialized since you canceled it.Please modify the print_adc function as shown below and try it on you side:
void print_adc() { result1 = gpadc_read(); arch_printf("\n\radc result: %dmv", gpadc_sample_to_mv(result1)); //If the ADC_timer is not initialized if (ADC_timer != EASY_TIMER_INVALID_TIMER) { //Re-Iniatilize the ADC_timer before starting it again. ADC_timer = EASY_TIMER_INVALID_TIMER; } ADC_timer = app_easy_timer(200, print_adc); }
Thank you its working, Now i want to add low power mode i.e Sensor is connected to DA14531 GPIO pin, So when sensor gives hig-;ow signal to DA14531, device should wake up connect to smartphone , send data and go to sleep mode again after disconnection from mobile, Please suggest how to achieve this and what needs to be configured .
I want to use extended sleep modes.