Configurable Custom Logic

It’s been a great past few days for progress on the book. I decided to tackle the Configurable Custom Logic. While I’m familiar with logic and FPGAs, I’ve never had a microcontroller with this feature before. I needed to study what it could do and come up with some reasonable example programs. Frankly, it doesn’t do much. And I needed to come up with a better way to present it than the data sheet did. I think I’ve been successful.

I’ve added some material about using the AREF and RESET pins as GPIO. Yes you can do that on the Arduino Nano Every (but not the older ATmega328 based boards). Unfortunately the pins are already connected which limits their usability somewhat, but it does mean that in many cases there are two additional GPIO pins available. The AREF pin has about 3µF of capacitance hanging off of it, which slows it down. The RESET pin can be easily used as a push button input (using the former Reset button), but using it as an output pin is a bit risky because of the chance of shorting it out by pressing the “reset” button.

I’m now moving on to the TWI/I2C interface. Like the earlier book, I’m recommending using the twi.h and twi.c files directly and, for the most part, not modifying them. They are more complete (one function to both send and receive data as a single command, like I modified the ATmega328 version) and flexible (master and slave are independent) now. The only important feature missing is non-blocking functions as masters. Arduino likes blocking functions. I don’t because they mean the program is stuck waiting for completion. So I’ll add that in.

Then it’s just a few more odds and ends and my first draft will be complete!