-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DRV_I2C_WriteReadTransferAdd stops working after a few seconds #25
Comments
@mumch , can you attach a basic project to reproduce the issue? |
Dear @vishalnxt sorry, I can't add our entire project and I don't have time to create one, as this bug threw me much behind the timeline. But additional to the information above, I can give you further details: The Harmony Project uses Core and NO RTOS, Core configuration in MHC: Compiler settings, which result in the issue occures: Init:
WriteReadTransfer (as a correction to the description above: one byte is sent and two are read):
I hope this allows you to reproduce it. |
@mumch , how do you know if the transfer has completed? In other words, can you share as to what you check to know if the transfer is still in progress or has completed? |
@mumch , thank you for the waveforms. But I will ask again, how do you ensure that the transfer has completed? Do you register a callback to get notified or do you call the DRV_I2C_TransferStatusGet() API. Please note that the call to the DRV_I2C_WriteReadTransferAdd API returns immediately. It only starts the transfer (or queues in the transfer if a transfer is already in progress) and returns. Rest of the transfer than takes place from the interrupt context. Application then needs to either wait for the callback (if registered) or poll the status of the transfer by calling the DRV_I2C_WriteReadTransferAdd() API. |
To your question regarding handle the transfer:
Notes: |
Sorry, I was adding the waveforms at the time you asked. And while you asked again I was writing the answer.. Yes, I am aware about the mechanism (asynchronous, etc). We poll and don't use callback as you can see above. We just have the stop-working issue if optimization-level is set to 2. |
Unfortunately, I have an update on this: The test just showed, I2C still stopps working after some time - although code-optimization set to 1 and 50 ms delay between next DRV_I2C_WriteReadTransferAdd(). In order to implement a Hotfix: Is there a possibility to reset the I2C1 and/or the DRV_I2C? This way we could reset it, when a timeout occures. |
@vishalnxt One question for now: In Errata of PIC32MM0256GPM064 are five issues listed (Number 9, 10, 11, 12, 13) regarding "I2C Client". We assume "Client" means Slave. But this unfortunate terminology is maybe misleading. |
@mumch Yes your understanding about I2C Client is correct. I2C Client means I2C Slave. |
@vishalnxt I have an update to issue number 2 (SCL and SDA remain high): We have debugged and logged the UART output to file. At the time when the problem begins, our firmware part runs once into the timeout and after this, nothing can happen again, because the I2C1_IsBusy() always returns true. And the reason for this is the I2C1STAT bit S, which stays 1 forever. |
@vishalnxt Any results from you regarding the Issue number 1 (SCL and SDA are pulled low by PIC)? Regarding issue number 2, we're running some tests with hacks (disabling and reenabling the I2C module). We're waiting on the next occurence to see, if it works. This is something which needs to be placed in the Errata of PIC32MM0256GPM064. Can you arrange this? |
@mumch , we are looking into it. We will update once we have something to share. |
@mumch , I ran some tests with Optimization set to 2 and continuously writing and reading from an external EEPROM, however I did not see any of the above issues. I am attaching the MPLABX project. The demo is run on PIC32MM USB Curiosity board, and a I2C EEPROM click board is used as the I2C slave. The I2C EEPROM click board is connected to J12 mikroBUS header. Can you take this and see if it helps? |
Hi @vishalnxt I will make a sample-project for you based on the PIC32MM USB Curiosity board, which allows to reproduce it. |
@mumch , just checking if you are still blocked on this issue? |
Dear @vishalnxt |
Hi @mumch , |
We use the I2C Driver (I2C1, single Master, single instance of driver using, sending 2 bytes everytime) of Harmony (Core Version 3.10.0) with a clock of 50 kHz on a PIC32MM0256GPM064. The XC32 Compiler Version is v4.00.
We send cyclic DRV_I2C_WriteReadTransferAdd and after some time (few tens of seconds), the communication stops working.
If we add a delay of 50 ms between the DRV_I2C_WriteReadTransferAdd calls, the I2C continues to work for a random time amount, but then still stops working. Examining the I2C with a scope shows SCL and SDA are pulled low by the PIC. And while it works, the Signals are clear and don't show any issue.
The hint found in #2 was helpful: If setting the gcc optimization-level to 1, the communication no longer stops working after some seconds. (Tested several times back and forth to be sure.)
I don't understand why the other issue was closed, without investigating the reason and fixing the bug, as it still seems to remain almost 2 years later..!?
The text was updated successfully, but these errors were encountered: