sanchezand / GBAHD-Shield

Shield for the Spartan Edge board to output HDMI for the Game Boy Advance
Other
16 stars 2 forks source link

Programming the chip is not possible when fully assembled #1

Closed kinoX51 closed 3 years ago

kinoX51 commented 3 years ago

I've ordered pcbs and parts, soldered everything together and tried to program the atmega328 with a arduino nano after the tutorial on the arduino.cc-website. When I try to burn the bootloader I get an error

avrdude: Device signature = 0xffffff (probably .avr8x_mega) avrdude: Yikes! Invalid device signature. Double check connections and try again, or use -F to override this check.

I've checked the wiring, and double checked my components - even when only the atmega is on the board I'll get the error message.

I've tried to switch the atmega for a 328pb, but still not luck.

I've used this crystal (https://lcsc.com/product-detail/SMD-Crystal-Resonators_XTY-7325-0800A2010-00_C389817.html) with the 22pf-caps, since there is no part number for a specific one.

Is there a special procedure what to solder first to get the bootloader on the atmega?

I have about 20 pcbs and parts here - would be nice to get them programmed.

Thanks!

kinoX51

sanchezand commented 3 years ago

I had problems programming the chip with 8MHz too, I am no expert at bootloader burning but I the issue is the bootloader is made for 16MHz crystals. There are bootloaders for 8MHz crystals but that requires changing arduino board definitions.

I had some 16MHz crystals with the same footprint around and that worked flawlessly. I forgot to change the BOM to 16MHz for an easier bootloader burning and more Ardunio IDE compability, but I changed it now.

kinoX51 commented 3 years ago

OK, I'll try a 16MHz crystal - is it possible to get an lcsc part number for that? What Arduino are you using to program the ATMEGA?

sanchezand commented 3 years ago

This one should work: https://lcsc.com/product-detail/SMD-Crystal-Resonators_Seiko-Epson-X1E000021037500_C89379.html

I used an Arduino nano to program the board. Sorry for the confusion!

kinoX51 commented 3 years ago

thanks for you help - I'll try that - arduino nano - old wiring-style or default-arduino-isp sketch?

kinoX51 commented 3 years ago

I've made some progress. After a lot of reading I was able to burn the bootloader onto the board with an 8MHz crystal - I've just needed to use MiniCore und slowing down the Baud-Rate zu 19200 when uploading the bootloader.

Nice to know: Since the board isn't providing a UART-Header the bootloader isn't even needed. It's possible to upload the sketch directly over the iscp header without having to upload the bootloader first.

I'm also able to upload the sketch using the programmer - but now I have another problem. When uploading the sketch to the atmega Pin 11 should be in a high state to switch on the power delivery on the WAS3157B When measuring the voltage on the output pin it only shows abount 0.8v not enough to power the gba.

When I close the jumper SJ1 the GBA turns on but no button presses are registered on the gba side.

Is the firmware the last revision?

Thanks!

ManCloud commented 3 years ago

This issue might be related to the fact, that the gerber files have a failure: the pin mapping for the Reset Button is wrong.

Therefore the microcontroller is held in reset statel.

To bypass this issue you can cut the pins of the button diagonally or simply dismount the button completely.

This should fix your problem ^^

sanchezand commented 3 years ago

Yes the gerbers are outdated and the issue was fixed on a later commit. I also ordered the pcb with the issue and soldered the button vertically but removing the button should work. As for the analog switch issue I had some problems powering the GBA from the ICSP headers. Try powering the shield mounted in the Spartan Edge. To debug the no button presses check for continuity from the gba test pads to the MCU and check the breakout's wiring

ManCloud commented 3 years ago

The analog-switch solution is not so good. According to the datasheet it has an internal resistance of 5.5 Ohm.

This lead to a voltage drop of approx. 0.4V @ 75mA (highest current I've measured on my GBA SP Board in operation without display).

On a OGBA board this would mean a voltage of 2.9V.

A high side switch with a mosfet is more suitable in my opinion.

Especially because there is only one "channel" used of the analog Switch.

kinoX51 commented 3 years ago

Ordering the board with the KiCad-Files lead to a working board with the switch mounted. With the help from ManCloud I was able to program the Atmega even with the 8MHz crystal - when i remember correctly 16MHz on 3.3v is not recommended as you overclock the Atmega and run it out of spec. To program the Atmega you don't need to upload the bootloader. Uploading the code using the programer is all that it takes. I've used the Minicore library in ARDUINO IDE to set the correct values (8MHz, external crystal etc.) and lowered the BAUD-Rate to 19200 in the Minicore boards.txt-file.

After that the board worked but I had issues to get the GBA running stable with an Everdrive or normal cartridge. This is due to the Analog Switch ICs voltage drop as ManCloud has pointed out. If you let the Analog Switch IC unpopulated and short SJ1 the GBA works perfectly without the IGR.

sanchezand commented 3 years ago

I never had issue with the analog switch restarting the GBA nor it not giving it enough current to the GBA, although I guess the GBA's condition could be at fault if that happens. In the new version I've removed the switch and its now using the GBA's reset pin.

Also the new version's BOM uses a 16MHz to avoid any problems flashing the firmware