Postby rew » Sat Jun 06, 2020 6:40 pm
With a dummy RX buffer it got past the checks. Then it locked on the second i2c transmit. This turned out to be that I had copied over the code from the '072(*): I had used AF1 for I2C on the F0 series, but it's AF4 on F7xx. This wouldn't have happened if there was a define that evaluates to 1 on the F0 and 4 on the F7. There probably is, but the example code needs to show how set the pad modes (with a comment that on this specific board for these specific pins it is not necessary) and how to do this. As it is, it is much easier to just look up the pad AF in the chip manual and use the number.
I had realized I needed to do this, as I remember it, I looked it up and changed the code. However it didn't arrive that way in the code I was actually testing today.
Then the data sent was correct on the "initialization sequence" but not afterwards. Adding a cacheflush before the transmit helped. Then the readback showed bad results. Again a cache flush helped, now a cache invalidate for the readback.
I then wrote my own wrapper around i2cMasterTransmitTimeout that will do the flush/invalidate before after each i2cMasterTransmit call. Then I forced that function to be the only mention of i2cMasterTransmitTimeout and then it worked perfectly first time! (seems that before I was missing one of the flushes).
On to writing the rest of the application..... Finally.
(*) I have an STM32F072 development board that I desgined. I remember explaining that to you guys but it seems I didn't hit "submit" on that message (yet).