How does I2C_Start() affect flash? | Cypress Semiconductor
How does I2C_Start() affect flash?
I have a piece of code that is continuously calculating a program CRC by scanning the PSoC4 program space. The initial CRC is calculated on the first POR. A 16-bit CRC is then stored in the last 2-bytes of the last row of the FLASH space and referenced for comparison. So, I scan from 0x0 to 0x00008000-sizeof(CRC). If the program memory ever changes during operation (i.e. the running CRC does not match the program CRC) the program is instructed to produce a fault code and discontinue normal operation.
I have been testing my project extensively. Everything works great. When I intentionally corrupt a random location in flash, as is typically done during verification and validation testing, the CRC checking catches the fault as expected.
Now here's the gotcha I'm hoping someone has an answer to. I have an I2C peripheral in the system, which is optionally enabled depending upon the device connected to a group of shared pins. During testing, I enable the I2C SCB by calling I2C_Start(). It is similarly disabled by calling I2C_Stop(). Within moments of calling I2C_Start() (and nothing else), the CRC checking process registers a change in the program memory and throws an error. I am surprised by this because the registers the processor and SCB blocks utilize are outside of my scanning area (0x40000000 – 0x4000FFFF and 0x40060000- -0x4006FFFF respectively).
I can only conclude that something in flash is changing but can find very little in the TRM to suggest what that might be. This behavior is the same whether interrupts are enabled or not during I2C_Start().
Does anyone know what in Flash is changing, where it is changing, or what other side effect starting I2C might have that ismaking the program think something is changing?