Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

functional with a 32U4? #2

Open
jmfriedt opened this issue Dec 24, 2024 · 3 comments
Open

functional with a 32U4? #2

jmfriedt opened this issue Dec 24, 2024 · 3 comments

Comments

@jmfriedt
Copy link

When setting the target option to atmega32u4 in the CMakeLists.txt and checking that indeed -mmcu=atmega32u4 is used during compilation (make VERBOSE=1), flashing the resulting integrated_server_elf in an Olimexino32U4 board by using

avrdude -c avr109 -b57600 -D -p atmega32u4 -P /dev/ttyACM0 -e -U flash:w:integrated_server_elf 

fails to create a /dev/ttyACM0 entry as would be expected from the LUFA CDC as seems to be expected from the avrdude commands provided in the README.md. Is there an easy way to get this gdb server running on an Atmega32U4 already flashed with the AVR109 bootloader?
Thanks.

@jmfriedt
Copy link
Author

I forked to https://github.com/jmfriedt/gdb-debug-wire-integrated-server: I see you define each microcontroller characteristics and added my understanding of the 32U4 settings, but am failing to see where you select which microcontroller to target apart the set(MCU atmega32u4) in CMakeLists.txt

@jmfriedt
Copy link
Author

This software is failing on Atmega32U4 because of

#define FE_IRQ_ENABLE() EIMSK |= (1 << INT7)

calling INT7 of EIMSK which exists on the Atmega32U2 (https://ww1.microchip.com/downloads/en/DeviceDoc/doc7799.pdf page 86) but not on the Atmega32U4! (https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7766-8-bit-AVR-ATmega16U4-32U4_Datasheet.pdf page 90)

@jmfriedt
Copy link
Author

jmfriedt commented Jan 2, 2025

Do you think you can help describe the open collector communication state machine? I am confused because after replacing PD7 (since INT7 does not exist on Atmega32U4) with PE6, and replacing all references to INT7 with INT6 and PD7 with PE6 (I think), the USB initialization still hangs (no ttyACM0 created). I am tracking src/dw/phisical/open_drain_serial.c and am confused because README.md states that 13 PD7 ISP - Reset but this file uses in TIMER1 ISR PIND (now PINE in my case) and tests the state with respect to fast_flag, so it sounds like PIND7 (now PINE6) is a communication pin rather than a RESET. I am also confused with the organization of fast_flags and uart_flags since I see the 4 least significant bits as cnt so a state machine, but the most significant bits seem to mix a state machine (next and wrt) with the status of PIND7 (now PINE6). I tried moving 1<<6 from this flag to 1<<7 (line 14 of src/include/dw_open_drain.h) to avoid conflicting with the state of the input pin (e.g. line 292 fast_flags |= (1 << PIND7) now becoming fast_flags |= (1 << PINE6)) but still hanging in this communication function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant