Losing BLE connection during I2C transmission.

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at https://www.dialog-semiconductor.com/support . We’ll be fixing bugs / optimising the searching and tagging over the coming days.
12 posts / 0 new
Last post
nigelyang
Offline
Last seen: 4 months 1 week ago
Joined: 2018-03-20 08:24
Losing BLE connection during I2C transmission.

Hi Dialog,

   My one of tasks is responsible for sending/ receiving massive data to external chip via I2C. I often enounter the problem that DA14681 sends wrong I2C signal( re-launch start condition ) and losing BLE connection within couple seconds.  I found as long as I increase connection interval, the rate of this problem happening is decreasing. Furthermore, the result is better after I added many slave latency.  I guess BLE TX/RX event of every interval  might take place during I2C transmission.  please take a look at the attached PDF file for understanding what I mean.  Is the problem possible ?   if yes,  how to prevent from BLE TX/RX event and I2C trnasmission happen at the same time? Is it possible to know when BLE TX/RX event happens in advance, then do I2C transmission in following step?

 

   thanks for your help.

 

 

Device: 
PM_Dialog
Offline
Last seen: 9 months 5 days ago
Staff
Joined: 2018-02-08 11:03
Hi nigelyang,

Hi nigelyang,

Let me check it and I’ll let you know.

Thanks, PM_Dialog

nigelyang
Offline
Last seen: 4 months 1 week ago
Joined: 2018-03-20 08:24
hi Dialog,

hi Dialog,

    Is there any solution for my problem?  thanks for your help

 

PM_Dialog
Offline
Last seen: 9 months 5 days ago
Staff
Joined: 2018-02-08 11:03
Hi nigelyang,

Hi nigelyang,

My apologies for the delay. So, if I understood correctly your description, the problem exists as soon as a I2C transaction is happening at the same time with a BLE event. Is this correct?

Does the application send the I2C values over notification in the peer device? When this issue occurs, does the device reboots or it just disconnects? Did you run it debug mode? Additionally, are you using any of the sleep modes?

I assume that an event with higher priority than the I2C might be that it is served in the ISR. The BLE interrupt is served with higher priority (PRIORITY_1) than the I2C (PRIORITY_2).

Thanks, PM_Dialog

nigelyang
Offline
Last seen: 4 months 1 week ago
Joined: 2018-03-20 08:24
hi Dialog,

hi Dialog,

  Yes, my problem is the BLE event (ack) and I2C transmission ( especially reading) take place at the same time. 

   It seems to reboot or I2C return 0x8001 failure( I use I2C adapter, e.g ad_i2c_read();). I observed the I2C signal transmission is devided into two (seems re-launch start condition because DA14681 cannot give a ACK when a byte finished)

   I got same result via two modes, debug mode and production. Should the results be different?   I used "pm_mode_idle" when the problem happened.  You mentioned that The BLE interrupt is served with higher priority (PRIORITY_1) than the I2C (PRIORITY_2).  I think so, the BLE event (resposne ACK) leads to the irregular I2C transmission, and let DA14681 go to unknow state ( reboot later) or still waiting for external data all the way. 

 I intend to know which task or function is responsible for sending BLE ACK in every connection interval, and allow me to do I2C tramission in the following step. 

 

PM_Dialog
Offline
Last seen: 9 months 5 days ago
Staff
Joined: 2018-02-08 11:03
Hi nigelyang,

Hi nigelyang,

What is the behavior in debug mode? Does the code get stuck? For example, are you getting any assertion or anything else.. This is happening only when the DA1468x is connected with a peer device?

Thanks, PM_Dialog

nigelyang
Offline
Last seen: 4 months 1 week ago
Joined: 2018-03-20 08:24
hi Dialog,

hi Dialog,

         Generally, tuck by I2C transmission. I do not use assertion. I use mobile App TX/RX data to DA14681, and process the data, then TX/RX data with external chip via I2C.

   I hope I could exactly know when the BLE event (acknowledge) happens, allow me to do I2C transmission between two connection events.  Is it possible to know the interrupt of BLE connection event ?  if yes, how to know?

  One more question, if DA14681 launches a request to change connection rate parameters, how long will it complete and adapt the new connection rate parameters? one connection interval or longer ?

   thanks for your help.

    nigel

PM_Dialog
Offline
Last seen: 9 months 5 days ago
Staff
Joined: 2018-02-08 11:03
Hi nigelyang,

Hi nigelyang,

Sorry for my late response. So, if I understood correctly, you want to trigger the application in every connection interval, Is this your requirement?

Regarding your second question, do you mean the connection update parameters procedure? Generally, the connection intervals are defined by the central, so what you can do, is to issue a connection update request and the central will decide if it will accept the connection parameters that you have requested. Do you mean how much it will take once the master has accepted the update parameter request?

Thanks, PM_Dialog

nigelyang
Offline
Last seen: 4 months 1 week ago
Joined: 2018-03-20 08:24
hi Dialog,

hi Dialog,

     Yes, I want to do I2C transmisstion between connection events.   Please teach me how to do ? 

    thanks for your help

     nigel

PM_Dialog
Offline
Last seen: 9 months 5 days ago
Staff
Joined: 2018-02-08 11:03
Hi Nigel,

Hi Nigel,

Yes, but is the device configured in sleep mode? In general, the system can go into sleep mode btween advertisign or connection intervals.

Thanks, PM_Dialog

nigelyang
Offline
Last seen: 4 months 1 week ago
Joined: 2018-03-20 08:24
Hi Dialog   

Hi Dialog   

  Where is the code (or function) which is responsible for sending the acknowledgment of BLE ? I want to know timing the code is executed, allows me to do i2c transmission immediately after the sending acknowledgment in order to ensure finishing i2c job before the next ack. Thanks

PM_Dialog
Offline
Last seen: 9 months 5 days ago
Staff
Joined: 2018-02-08 11:03
Hi Nigel,

Hi Nigel,

Please take a look at Section 7.7 BLE Interrupt Generation in the UM-B-044: DA1468x Software Platform Reference user guide. Please check the following bullet :

ble_event_irq: End of Advertising / Scanning / Connection event. Used to cleanup/reinitialize state and defer TX/RX handling operations.

After that see section 8.3.4 Hooks in UM-B-056: DA1468x Software Developer's Guide document. The BLE Hooks mechanism provides the user application a way to be notified about the exact time of occurrence of specific BLE events. Please see figure Figure 41: Connected.

Thanks, PM_Dialog