Forums - Problem with I2C and NVM

2 posts / 0 new
Last post
Problem with I2C and NVM
Acutetech
Join Date: 29 Jul 16
Posts: 25
Posted: Tue, 2017-02-07 07:57

This is related to two previous CSR101 topics which basically say that using I2C breaks NVM and vice versa:

https://forum.csr.com/forum/main-category/main-forum/software/41847-prob...

https://developer.qualcomm.com/forum/qdn-forums/hardware/bluetooth-conne...

In the first of these, Andrew and Hai Son claim to have fixed the bug but don't provide enough detail for me. I have followed the pattern in the ancs example as best I can, without success. I am using a large (SPI) flash chip rather than I2C, so my case is not identical: I suspect the problem is NOT with the I2C pullup resistors.

Why do the Nvm and I2C interfere with each other, and how can I fix this? Could Andrew or Hai Son publish their code, perhaps?

Thanks - Charles

  • Up0
  • Down0
Acutetech
Join Date: 29 Jul 16
Posts: 25
Posted: Wed, 2017-02-08 11:31

This is a nasty little bug.

I spent time working with the "large_nvm" sample application, and found that there was no problem with the NVM (in large flash) working at the same time as I2C peripherals. So I decided to replace the nvm_access code I had been using previously with the library that comes out of  large_nvm sample application. It looked OK until I changed the base address of the NVM from 0x1a000 (used by default in large_nvm) with 0xe000 (used in my earlier code). That breaks it.

Looking at the sourec code in large_nvm sample, it appears that if the NVM is placed in memory above the 0x10000 boundary then the large_flash.h library is used, and everything is fine. But if NVM is placed below the 0x10000 boundary then the spi_flash.h library is used instead, and calls to spi_flash functions (at least the first, which is to erase a block) time out. As we have no access to the code in these libraries it is not possible for me to debug further.

Note that using large flash with NVM below 0x10000 work fine UNLESS you also use the I2C calls.

I tried to return to my earlier code to set the NVM above 0x10000 with an entry in the .keyr file, but this fails with "ERROR: Invalid key size".

So for me the fix is to use the large_nvm library as a replacement for the nvm.h code, and to set the NVM start address at 0x10000 within a.h file.

Nasty and time consuming. It would be nice to have a response from CSR on this topic.

Regards - Charles

 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.