Hello,
Today, I spent all my day on a bug with SPI1. Each transaction lead to a BITERRFLG. Never saw that error on SPI3 and SPI4. After extensive investigation, finally found that if pin E18 is programmed as USB1.OverCurrent, and its state is 1, then BITERRFLG is systematically set after a transaction. If USB1.OverCurrent is low, then no BITERRFLG.
I found it because on the HDK, if USB1 is disabled, bit 17 of PC2 (DIN) is 0, and on my board is 1… Turned USB1 ON on the HDK: bit 17 is 1 and each transaction started to set BITERRFLG.
The function that HALCoGen generates doesn’t send any data on SPI if any of the flags are set. I easily worked that around by clearing BITERRFLG before any call to SPI functions.
Now that I understanding the behavior of SPI1, I am convinced that my hardware is okay.
Am-I the first one to find this bug? I found nothing in the Errata.
Thanks and regards,
Hugues