I have been trying to setup my XMEGA-B1 Xplained board to read an iC Hauss iC iC-TW11 rotary encoder. I am starting off with the B1 Xplained board and since that has an Atmel 45DB642DB EEPROM onboard and talks to it using USART SPI I thought I would try to leverage off the demo code.
I am using Atmel Studio 7 with an Atmel ICE.
Unfortunately the demo application gets stuck somewhere and doesn't run properly. It would have been nice to have code that is not broken to have confidence that what I copy can be made to work.
I have been trying to understand how the SPI is set up, but digging through file after file of #defines and #ifdefs to see how the Xplained board is setup to use the upper nibble of the C port etc. I have got quite bamboozled.
I have seen posts to this forum of people sorting this out but they tend to have started from scratch. I would have liked to keep the same framework as the example.
When the demo board arrived it did run with the firmware that was already loaded. When I ran the debugger with the code from the example demo it was broken.
I can see in usart_spi.c there is a function usart_spi_setup_device() that looks like it might setup the stuff properly, and in there there is a call to usart_init_spi() which looks like it also does something useful to set up things correctly. However both of those things are never used in the demo.
This is my first time using any of this. I have used in circuit emulators sporadically over the years but I am far from being an expert at anything.
Anyone with any clues?