My impression that the "output" is the audio system in the USB master.
But, this raises a suggestion. Output the data to a port and observe it with a 8-wide logic analyzer. OR, feed that data into an 8-bit parallel input DAC and observe it as an actual audio signal.
I lay about 40% odds on USB, and 50% odds on the analog conversion process (this encompasses power supply, reference, input signal, and ADC). That leaves 10% for programming, MCU timing, and acts of divine retribution.
Jim
Until Black Lives Matter, we do not have "All Lives Matter"!
Posted by mehrdad_58: Sun. Sep 22, 2019 - 05:57 AM(Reply to #51)
1
2
3
4
5
Total votes: 0
Thanks JC,
But some facts about my board.
1. it is a peripheral device which is connected to a PC via USB cable.
2. The power supply of my device is get form USB port.
3. data is captured from ADC channels and send to PC via USB out endpoints.
4. data is sent from PC to device and is played on DAC channels via USB in endpoints.
5. The only way that I can see the output of ADC channels is to get them in PC and use an editor software like Audacity to see it.
6. Thus if I use a battery then how I can transfer data to PC?
7. By using a median filter, the quality of captured ADC signals are better.
8. noise happens in a periodic way and I guess it is from USB transactions with PC.
9. when I discard USB write transactions from PC side and just read ADC samples, the duration of noise decreases which gives me a clue that USB transactions may be in charge .
10. as decoupling capacitors are away from power pins of Xmega micro controller, I am afraid if urgent current can not be feed to micro Controller when USB transactions are in progress and those noises happens.
You can intercept (e.g. break the circuit) the power from the USB connector and provide power to that point via battery or an adjustable clean power power supply.
Jim
Until Black Lives Matter, we do not have "All Lives Matter"!
10. as decoupling capacitors are away from power pins of Xmega micro controller, I am afraid if urgent current can not be feed to micro Controller when USB transactions are in progress and those noises happens.
I don't think you understand the purpose of decoupling caps.
I'd be guessing pcb layout is a possible culprit. But you've not shown us this.
Try using another USB port on the host. Try using another host computer.
If there is a periodic 1.6 second pulse on VCC, you might be able to see that on your scope.
If you can put the result of the ADC out on an Xmega pin, you could disconnect from the host.
The numbers you get from the ADC should be much higher during the periodic noise. You could look at the numbers. When the numbers are low, set a digital output pin low. When the numbers are high, set the digital pin high. Look at that pin with with a scope or even a DMM to see if the 1.6 second pulse is there when not using the USB.
You could also export the ADC result on an analog pin by using the DAC. Look at that pin when not using the USB.
Those 2 white circles are decoupling capacitors that was designed to be placed near VCC and GND
pins of micro controller.
Ouch. I think I see a massive ground loop. The GND pins on the micro all come together under the chip, but then the only connection I see is by a blue track to the left and then it disappears in the upper left corner. Presumably it loops all the way around the PCB, and then come back down to the decoupling cap on the right side.
If that is so, then your GND connection is more like a H-field antenna that can pick up all sorts of noise from the surrounding circuitry.
I’d throw that pcb in the bin. The power routing is suspect at best. It could be the regulator oscillating occasionally. Showing us a small part of the pcb is not going to be too conclusive as the problem is probably not in the area you’ve shown.
Tell your pcb guy that putting vias in the middle of pads is not a good idea. Nor is doing copper fills that aren’t tied to a ground plane.
We’ve got nowhere near enough information. If you want to learn, there’s plenty of tutorials on line. It helps if you understand basic electronics as the pcb is a critical component - not just an interconnect.
Don’t waste your time. The problems can’t be fixed by cutting tracks and adding bits of wire.
Get the design right first. Getting pcbs made is fairly cheap.
Having components on both sides makes assembly expensive. It is usually cheaper to go to a four layer pcb with components on one side only
Posted by agentXMEGA: Mon. Sep 23, 2019 - 05:37 PM
1
2
3
4
5
Total votes: 0
mehrdad_58 wrote:
Please give me some hints about routing signals and power and ground.
Here is a simple project on ATXMEGA32A4U.
I do not like this pcb.
But she is better than the one you showed.
The analog part is not used in this project.
Some don't like jumpers or zero ohm resistors as jumpers though the 1-layer PCB of old have some tinned jumper wires.
A PCBA manufacturer might have a jumper machine.
XMEGA32A4U pin 35 is RESET with a trace that has some susceptibility; not an issue if the PCBA is inside its own metal or metallized enclosure that has complete, precise, and correct shielding.
Inside a chassis, above a few megahertz, the references (grounds) will be relative to each; if that's an issue, there are simple solutions.
There are some important lessons here, and more lessons to be learned.
1) You have found that your board needs improvement, and some suggestions about what to do. That may be a necessary change, but it MIGHT not be sufficient. How can we say that? Well, partially because there has yet been no way to determine the source of the noise. It MIGHT still be software or something in the USB system or even your desktop hardware and software. Nobody can tell. Yet. Or, it might be that the board upgrade solves it all. You will never know until you try.
2) These problems are hard to track down. Really hard. it tends to be a war of attrition rather than a pitched battle followed by a victory celebration. Its just the way the universe works.
3) Because it is hard, you have lots of ideas about how to solve. Which one is the solution? Maybe none, maybe one not yet suggested. We can't know. We might never know.
4) Suggestion: post the schematic and the layout (with modest component detail where it is not obvious) before you send it out to your board house. You are bound to get some comments. Some of those might even be useful :) This could save you a subsequent board rev or several.
Good luck
Jim
Until Black Lives Matter, we do not have "All Lives Matter"!
- Log in or register to post comments
TopMy impression that the "output" is the audio system in the USB master.
But, this raises a suggestion. Output the data to a port and observe it with a 8-wide logic analyzer. OR, feed that data into an 8-bit parallel input DAC and observe it as an actual audio signal.
I lay about 40% odds on USB, and 50% odds on the analog conversion process (this encompasses power supply, reference, input signal, and ADC). That leaves 10% for programming, MCU timing, and acts of divine retribution.
Jim
Until Black Lives Matter, we do not have "All Lives Matter"!
- Log in or register to post comments
TopThanks JC,
But some facts about my board.
1. it is a peripheral device which is connected to a PC via USB cable.
2. The power supply of my device is get form USB port.
3. data is captured from ADC channels and send to PC via USB out endpoints.
4. data is sent from PC to device and is played on DAC channels via USB in endpoints.
5. The only way that I can see the output of ADC channels is to get them in PC and use an editor software like Audacity to see it.
6. Thus if I use a battery then how I can transfer data to PC?
7. By using a median filter, the quality of captured ADC signals are better.
8. noise happens in a periodic way and I guess it is from USB transactions with PC.
9. when I discard USB write transactions from PC side and just read ADC samples, the duration of noise decreases which gives me a clue that USB transactions may be in charge .
10. as decoupling capacitors are away from power pins of Xmega micro controller, I am afraid if urgent current can not be feed to micro Controller when USB transactions are in progress and those noises happens.
Thanks
- Log in or register to post comments
TopYou can intercept (e.g. break the circuit) the power from the USB connector and provide power to that point via battery or an adjustable clean power power supply.
Jim
Until Black Lives Matter, we do not have "All Lives Matter"!
- Log in or register to post comments
TopI don't think you understand the purpose of decoupling caps.
I'd be guessing pcb layout is a possible culprit. But you've not shown us this.
- Log in or register to post comments
TopThanks guys.
I have learnt how fix a bug from the discussion.
শূন্য - The ZeRo
- Log in or register to post comments
TopTry using another USB port on the host. Try using another host computer.
If there is a periodic 1.6 second pulse on VCC, you might be able to see that on your scope.
If you can put the result of the ADC out on an Xmega pin, you could disconnect from the host.
The numbers you get from the ADC should be much higher during the periodic noise. You could look at the numbers. When the numbers are low, set a digital output pin low. When the numbers are high, set the digital pin high. Look at that pin with with a scope or even a DMM to see if the 1.6 second pulse is there when not using the USB.
You could also export the ADC result on an analog pin by using the DAC. Look at that pin when not using the USB.
- Log in or register to post comments
TopI don't think you understand the purpose of decoupling caps.
I'd be guessing pcb layout is a possible culprit. But you've not shown us this.
Let me show a picture from PCB part of my design.
Those 2 white circles are decoupling capacitors that was designed to be placed near VCC and GND
pins of micro controller.
There are 2 other ones that is not in this shot and are far far far away

The board is a 2 layer one.
Apparent that micro controller is that 44 pin TQFP in the center of picture.
- Log in or register to post comments
TopYou could also export the ADC result on an analog pin by using the DAC. Look at that pin when not using the USB.
Above sentence is one the most professional sentences that I have heard yet.
Thanks steve17, You prove that you are very professional.
Before this, I always think of my board as a Black box, Now you open some windows on the walls of it.
- Log in or register to post comments
TopOuch. I think I see a massive ground loop. The GND pins on the micro all come together under the chip, but then the only connection I see is by a blue track to the left and then it disappears in the upper left corner. Presumably it loops all the way around the PCB, and then come back down to the decoupling cap on the right side.
If that is so, then your GND connection is more like a H-field antenna that can pick up all sorts of noise from the surrounding circuitry.
- Log in or register to post comments
TopThis is crazy.


Sorry for my English.
- Log in or register to post comments
TopI’d throw that pcb in the bin. The power routing is suspect at best. It could be the regulator oscillating occasionally. Showing us a small part of the pcb is not going to be too conclusive as the problem is probably not in the area you’ve shown.
Tell your pcb guy that putting vias in the middle of pads is not a good idea. Nor is doing copper fills that aren’t tied to a ground plane.
- Log in or register to post comments
TopIt seems that PCB is not good.
Please give me some hints about routing signals and power and ground.
I collected more that 10 changes till now.
Please give me some hints to apply in next step, Please remember that the board is a 2 layer one.
I need some design patterns for PCB.
Thanks
- Log in or register to post comments
TopWe’ve got nowhere near enough information. If you want to learn, there’s plenty of tutorials on line. It helps if you understand basic electronics as the pcb is a critical component - not just an interconnect.
- Log in or register to post comments
TopI developed this board to be a pilot one and I would like to get as much as possible knowledge from it.
Now that we know the design of PCB is not OK, I would like to apply some changes to it by using some wire soldering and component montage.
I have following ideas:
1. Solder a through hole decoupling cap between each VCC and GND pins of micro controller. (VCC and GND pins in XMega are near each other).
2. solder 4 wire between GND pins of micro controller and some GND pins in different points of board to break current loop.
I do above things because I would like to learn as much as possible from current situation.
Please give me any other ideas which may help
Thank you.
- Log in or register to post comments
TopDon’t waste your time. The problems can’t be fixed by cutting tracks and adding bits of wire.
Get the design right first. Getting pcbs made is fairly cheap.
Having components on both sides makes assembly expensive. It is usually cheaper to go to a four layer pcb with components on one side only
- Log in or register to post comments
TopPretty sure
AtmelMicrochip have App Notes on that.The principles of good grounding, analogue/digital supply separation/isolation, etc are pretty general - not specific to AVR.
So general tutorials on mixed-signal PCB design should help ...
Top Tips:
- Log in or register to post comments
TopAN_1619 AVR040: EMC Design Considerations | Application Notes | Microchip Technology Inc. (page 13 for "4.7. PCB Layout and Grounding")
via ATxmega32A4U - 8-bit AVR Microcontrollers
"Dare to be naïve." - Buckminster Fuller
- Log in or register to post comments
TopChapter 4.6 is also worth a closer look (Power Supply, Power Routing, and Decoupling Capacitors)
- Log in or register to post comments
TopI do not know how to say thank you.
Now I have some documents to proceed.
- Log in or register to post comments
TopHere is a simple project on ATXMEGA32A4U.
I do not like this pcb.
But she is better than the one you showed.
The analog part is not used in this project.
Sorry for my English.
Attachment(s):
- Log in or register to post comments
TopSome don't like jumpers or zero ohm resistors as jumpers though the 1-layer PCB of old have some tinned jumper wires.
A PCBA manufacturer might have a jumper machine.
XMEGA32A4U pin 35 is RESET with a trace that has some susceptibility; not an issue if the PCBA is inside its own metal or metallized enclosure that has complete, precise, and correct shielding.
Inside a chassis, above a few megahertz, the references (grounds) will be relative to each; if that's an issue, there are simple solutions.
Thank you for your post.
https://en.wiktionary.org/wiki/susceptibility
"Dare to be naïve." - Buckminster Fuller
- Log in or register to post comments
TopThanks friends for you kind support
- Log in or register to post comments
TopThere are some important lessons here, and more lessons to be learned.
1) You have found that your board needs improvement, and some suggestions about what to do. That may be a necessary change, but it MIGHT not be sufficient. How can we say that? Well, partially because there has yet been no way to determine the source of the noise. It MIGHT still be software or something in the USB system or even your desktop hardware and software. Nobody can tell. Yet. Or, it might be that the board upgrade solves it all. You will never know until you try.
2) These problems are hard to track down. Really hard. it tends to be a war of attrition rather than a pitched battle followed by a victory celebration. Its just the way the universe works.
3) Because it is hard, you have lots of ideas about how to solve. Which one is the solution? Maybe none, maybe one not yet suggested. We can't know. We might never know.
4) Suggestion: post the schematic and the layout (with modest component detail where it is not obvious) before you send it out to your board house. You are bound to get some comments. Some of those might even be useful :) This could save you a subsequent board rev or several.
Good luck
Jim
Until Black Lives Matter, we do not have "All Lives Matter"!
- Log in or register to post comments
TopThanks Jim,
- Log in or register to post comments
TopPages