I'm completely baffled at this point, and don't fully expect any good responses to this post, as the results are so vague, but thought I'd put this out there anyway.
Have been running on the hercules for a few months now. Have created a custom RTOS based SW solution referencing a lot of the HALCoGen base code, and it has worked well to date, but we've run into a snag. When creating the system initialization code, there was initially a mistake made, the base address of the flash registers was missing an F (0x0FF87000 vs 0xFFF87000). So essentially, the routine below was writing to a RESERVED area of memory. The clock settings we were using worked fine with the default waitstates on the Flash, but when we started trying to use the EEPROM, we noted this problem since the defaults were not sufficient.
Here's the strange part. When we made this update, the CPU loading went up by a factor of 40 in I/O heavy routines (ex. many writes to UART)! I found this really odd, so I went through many tests including
- Removed calls to set flash controller timings
- Removed all calls to flash controller
- Disabled mpu, cache, etc. (in combination with two items above)
- Added synchronization barriers between all calls
- Relocated code into RAM and executed
None of these had any effect. However, adding a single write to the RESERVED region from 0x08480000 and 0x30000000 causes the I/O to speed up. It doesn't matter when I make this write, it has this effect. I boot, profile an algorithm that has I/O, writel(0, 0x08480000), then run algorithm again, and see this delta. Effectively, the I/O is in super snail mode until I make this random write into this specific memory space.
I have verified that I'm not getting any spurious IRQ or exceptions in this scenario, so am just completely befuddled as to what might be happening here...is a bit hard to sell this random line of code in our system to "Enable fast I/O" since we don't know what is going on...anyone have any thoughts?