The ASF library is written for SPI, but the displays with attached breakout board are predominantly I2C. I'd appreciate any advice on how to drive them.
Atmel Studio 7.0.2397
Life is obviously easier with an Arduino. But Atxmega32a4u is not used for any official Arduino boards.
The next easy way is Codevision. It provides plenty of examples. It has a Wizard for setting up Xmega, Xtiny, Mega, ... projects.
Most importantly, it comes with libraries for many Graphics chips e.g. SSD1306 both I2C and SPI
It is very straightforward to change the low-level drivers from SPI to I2C in any regular program.
Obviously ASF makes my head hurt.
If you quote the name of the specific ASF example project, I will build it for SPI.
Then re-build for I2C.
Which I2C pins do you want to use?
SSD1306 display boards are available in both SPI and in I2C. At least for 128x64. The 128x32 or 64x32 boards are mostly I2C.
Download this Microchip document about using I2C with XMEGA. Download the document about the differences between XMega and Mega for referencing peripheral SFRs as well.
Title:AVR1308: Using the XMEGA TWI
Description:This application note describes how to set up and use the TWI module in the XMEGA. C code drivers and examples are included for both master and slave applications.
With TWI working on the 32A4U you can use the simple techniques that are used access the OLED with I2C covered in earlier messages here.
Thank you for the pointers, david.prentice and Simonetta. I was afraid you'd say something like this. I have put the project on the back-burner for now, but will revisit again in the near future and follow your advice.
I could probably get you going with I2C displays on the Xmega32A4U.
However, if you are happier with ASF, I suggest that you just buy an SPI SSD1306. They are very cheap.
Alternatively, Codevision comes with support for many different displays. But more importantly, the CodeWizard gets you started with Xmega much more easily than ASF.
Obviously with the cost of the licence which pays for itself by the hours saved for Xmega project development.
© 2020 Microchip Technology Inc.