Hello guys.I made a PCB board with ATMega2560-16au as the main control chip, and both the material and SMT work were sourced from a single factory. After I received the board, I conducted a simple programming test on it. The specific task was to call the PL0 pin to control the light on and off of the LED. From the results, it was controllable, but there was an issue with the time interval between the lights on and off. I delayed for 1000ms, but in fact, the delay was more than 10s. Therefore, I suspected that there was a problem with the configuration file of the chip when it was shipped from the factory, so I used Arduino IDE to re burn the bootloader. However, after burning the bootloader, I couldn't even control the PL0 pin. The digital mapping of the PL0 pin should be 49, but after burning the bootloader, I couldn't control it anymore. The burning method was ICSP. I am not sure where the problem lies as I am using the USB ASP driver. (I once customized a PCB board with an ATMEGA328P main control chip in this factory, and I also encountered the problem of incorrect delay time. It was solved by burning the bootloader again, but this time I may have encountered trouble. Burning the bootloader cannot solve the problem.) (Is it possible that the bootloader file I burned is incorrect, but I did burn mega2560)
Sounds like an error in the clock configuration.
Let's have a look at the schematic of your board, in particular the clock section, and perhaps you can explain how you've configured the MEGA's clock.
Does that mean you can't control that single pin, or nothing works on the board? In other words: does anything still work? UART output for instance (unlikely given your clock problems)?
I'm sure you know this but thought I would throw it out there. Make sure you're not using a USBTiny/Pocket AVR ICSP programmer. Those are good for devices up to 64K Flash and work fine for Atmega328's. If that is covered, I would look at your device configuration bytes. Here is a link to a handy tool I use: https://www.engbedded.com/fusecalc/
Thank for your reply. I did not do anything for clock configuration 。I just used usbasp to burn the blink program after receiving the pcb board , and found that the led could light up but there was a problem with delay. And I think using pins to light the led is the easiest way to verify whether the board works. As for the question whether other pins can work, emmm the purpose of drawing this pcb board is only for i2c communication, so I only drew out a few oins, probably similar to making a minimal mega system, so that I did not draw out other useless pins.. Therefore, it has not been verified whether other pins can work, but at least the led pins including PL0,PL1,PL2 cannot work. I wonder if the bootloader programs i have burned is a wrong one , leading to the problem of pin mapping.
And how to configure the clock in arduino? maybe next time i meet the problem,i can configure the clock first rather than burn bootloader directly haha.
Burning the bootloader using the IDE before you upload other code would be the easiest.
You might already know the following. Programming over ICSP wipes previous programs. So burning the bootloader after you did burn the sketch to control PL0 wipes that sketch and you will have to upload it again. And loading the sketch via ICSP will wipe the bootloader (but not affect the fuses).
Your description does not state if you indeed did load the sketch again after burning the bootloader so maybe you forgot?
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.