Yesterday's great puzzle? With the I2C bus sprouting inexplicable errors when two tasks were taking turns using it?
Today's sleuthing led to the discovery that the device driver's interrupt handler thought there was an SCL LOW timeout, which apparently is an SMBUS thing. The timeout was indeed enabled (I don't recall whether that was the default or I'd turned it on because it sounded like a good idea), and set for 100μs, which ought to be a safe enough value. And, for some reason, the timeout was happening.
Now, I do have the bit rate set higher than officially allowed (the MCU configuration program complains if I set it above 100kHz, and I have it set for about 400, except for having dialed it back to 200-ish for most of yesterday's testing). Maybe some interaction between a high bit rate and the lumpy timing of operations in a multitasking setting was causing the timeout counter to expire?
Well, whatever. It seems to be working properly now, so now I can get back to making progress on the actual project.
Update: All's well behaved (if not entirely complete) at this point. Got a Ruby program standing in for the actual host device, with a nice shiny GUI; said program isn't just for the current test & debugging phase, as it'll likely be used in the client's lab for testing and tuning toaster subsystems; thus, it's worth putting in a little effort to make it friendly.
...Also, there's another set of feature that, now as I think of it, I should be adding to the host-simulator-and-console program: calculating register values to implement human-intelligible control parameters. (One of the Features in the CPLD logic is a pseudo-thermal duty-cycle limit, which takes three register settings, whereof the values are a right pain to calculate manually, and easy to get wrong. I need to provide boxes to fill in desired maximum percentage duty cycle and maximum cumulative excess, and a button to calculate the nearest available approximation given the constraints, set the registers, and display the "as implemented" values.)
Comments