ATmega32u4 partially working

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
benbergman
 
Posts: 12
Joined: Thu Feb 12, 2015 11:48 pm

ATmega32u4 partially working

Post by benbergman »

I'm working on a custom keyboard that uses an ATmega32u4 and MCP23018 IO expander, similar to the Ergodox (a keyboard split into two independent sections). My firmware is based on the open source TMK firmware project[1]. My code can be found here[2].

I got to the point where all the keys connected directly to the 32u4 were working, so I wanted to add the I2C code. When I added this code, the keyboard started acting weird and caused my computer to start acting up too, perhaps I had inverted some signal lines so all buttons appeared pressed?

I removed the I2C code and reverted to what had been working previously. Now my keyboard is sending incorrect key codes over USB. If I change my keymap, the incorrect codes change, but they are still incorrect. I swapped out my 32u4 dev board for a spare and flashed the same old, working code and sure enough things are working again.

The code that started causing me issues are the lines commented out in the matrix.c file[3]. The rest of it works on the replacement dev board and originally worked on the now broken(?) dev board.

Does anyone have any ideas how a 32u4 could start acting up like that? Is there any way to recover from such a failure?

[1] https://github.com/tmk/tmk_keyboard
[2] https://github.com/BenBergman/tmk_keybo ... berkinesis
[3] https://github.com/BenBergman/tmk_keybo ... s/matrix.c

PS. It appears the schematic posted on GitHub for the 32u4 breakout board is out of date. The image in the store shows VCC and RST broken out to the main header pins, which is very useful. The schematic on GitHub is missing these pins.

User avatar
benbergman
 
Posts: 12
Joined: Thu Feb 12, 2015 11:48 pm

Re: ATmega32u4 partially working

Post by benbergman »

I solved my problem! When the board started acting up, it must have corrupted the EEPROM, which is used for various settings in the firmware. I read the EEPROM out of my spare dev board and flashed it to the broken one and now all is working again. :D

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: ATmega32u4 partially working

Post by adafruit_support_mike »

Glad to hear it's working for you.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”