MCUdude / MightyCore

Arduino hardware package for ATmega1284, ATmega644, ATmega324, ATmega324PB, ATmega164, ATmega32, ATmega16 and ATmega8535
Other
637 stars 181 forks source link

Issue with uploading through Serial0 on custom PCB #294

Closed The0Scorpion closed 3 months ago

The0Scorpion commented 3 months ago

I have just received my new PCBs for my graduation project, but I'm having difficulty uploading via the USB to TTL, this the first time for me including a ch340 'USB to TTL chip and a USB port to program my PCB directly. After some fiddling, I got the PC to recognize the ch340C finally (it was a random soldering issue), and now when I type in Serial Moniter the Leds light up. Also when I upload a sketch that writes to serial the TX led lights up. The problem is I can't see the characters Sent from MCU in Serial, also The MCU can't see the data sent to it (I tested that with a simple if "Serial.available()>>> light a led" sketch) So TLDR the MCU and CH340C are sending some data but they don't understand each other.

the setup: image

image

I'm using an Atmega32 instead of the 324 for development reasons The caps C17,C13 are 150nf instead of 100nf because of local supply issues

what I tried:

  1. An external USB to but still didn't read any data, I think that is because if the ch340 being on the same data lines.
  2. changing programming baud rate
  3. switching from the external crystal to internal crystal with multiple different frequencies.
  4. changed the resistors R26, R27 to 4.7k and to 0ohm (just shorting them)

What am I doing wrong? should I continue diagnosing the PCB itself for soldering issues or is there is something fundamentally wrong with my design.

MCUdude commented 3 months ago

If this this is a graduation project I'd definitely put some time and effort getting the schematic readable. I'd like to see the clock/crystal and the auto-reset circuity. Can you post the complete schematic?

I usually point users to my DIP-40 development board I sell on Tindie as a hardware reference. Its schematic are also quite easy to understand and follow.

But if the LEDs lights up, but the microcontroller isn't receiving any data, it may be because you haven't connected the RX and TX pins from the microcontroller directly to the CH340 RX/TX pins, but rather on the other sides of the resistors that's current limiting the LEDs.

image
The0Scorpion commented 3 months ago

Thanks for the hasty response, I realized my mistake before I saw your response and removed the LEDs completely and replaced the current limit with 0Ohm resistors and it worked! I wanted to share the complete schematic, but my team won't allow that. I did read your DIP-40 development board guide and other ch340c guides, but it was simply my mistake. Also, I'm in the process of making both my software and Schematics more readable, Sorry for making you suffer through it. Everything works now! Other than a better-quality USB cable I'm ready to implement my software. Here is pictures of the Actual PCB: image image Thanks for help so much.

MCUdude commented 3 months ago

Great to hear you figured it out. Good luck with your project!