Author Topic: ATMega16 weird behavior  (Read 1293 times)

0 Members and 1 Guest are viewing this topic.

Offline DavidDLCTopic starter

  • Frequent Contributor
  • **
  • Posts: 755
  • Country: us
ATMega16 weird behavior
« on: June 22, 2022, 01:41:27 am »
We are working on a project that involves an ATMEGA16 microcontroller connected through USB as a COM Port.

Somebody else made the hardware and firmware design, I just jumped to help with this issue

Every time we send a byte and the microcontroller process it the current goes down and close to 0, sometimes the microcontroller will reset. Any operation, even when the command is set to do nothing (just receive the byte)

I'm thinking of a Brown Out condition, but I'm approaching the forum if somebody has experience or another clue of what might be causing this issue.

Attached is a chart of the current going down.

If somebody can help we really appreciate it
 

Offline tepalia02

  • Regular Contributor
  • *
  • Posts: 100
  • Country: bd
Re: ATMega16 weird behavior
« Reply #1 on: June 22, 2022, 10:54:57 am »
Which hardware are you using to program the ATmega16? Is it USBASP?
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 4784
  • Country: pm
  • It's important to try new things..
Re: ATMega16 weird behavior
« Reply #2 on: June 22, 2022, 01:37:19 pm »
Do you have the USB made via software? Is there a schematics available?
 

Offline DavidDLCTopic starter

  • Frequent Contributor
  • **
  • Posts: 755
  • Country: us
Re: ATMega16 weird behavior
« Reply #3 on: June 22, 2022, 05:26:52 pm »
Tepalia02: Yes, we are using the USBASP.

imo: The unit connects as COM port and unfortunately they don't let me share the schematics

 

Offline Carel

  • Regular Contributor
  • *
  • Posts: 86
  • Country: nl
Re: ATMega16 weird behavior
« Reply #4 on: June 23, 2022, 10:58:50 am »
Look for a more "official" programmer. A couple of weeks ago I bought a USBASP programmer, one of my STK500's is broken. The software is a nightmare. Seemingly it bypasses the USB chip on the PC side to emulate a serial connection. When my mouse stopped working, I quit on it.

I am now going to order an AVRISP mkii.
 

Offline tepalia02

  • Regular Contributor
  • *
  • Posts: 100
  • Country: bd
Re: ATMega16 weird behavior
« Reply #5 on: June 23, 2022, 12:37:38 pm »
Which loading software are you using? Is it AVRdude? If you try to read the fuse bits of the microcontroller, can you read? AVR chips often behave weirdly because of wrong fuse bits. 
 

Offline DavidDLCTopic starter

  • Frequent Contributor
  • **
  • Posts: 755
  • Country: us
Re: ATMega16 weird behavior
« Reply #6 on: June 25, 2022, 03:35:19 am »
I found the problem.

They have two port pins connected to ground, I set them as inputs and this solved the problem.

The software developer said he checked the data sheet and they supposed to be inputs by default (I didn't check) and maybe the bootloader was setting them as an outputs, he copied the bootloader from the web.

Thanks for your answers
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4036
  • Country: nz
Re: ATMega16 weird behavior
« Reply #7 on: June 25, 2022, 10:06:43 am »
The software developer said he checked the data sheet and they supposed to be inputs by default (I didn't check) and maybe the bootloader was setting them as an outputs, he copied the bootloader from the web.

I would think it would be very bad for any microcontroller to default to any pins at all being outputs, and start trying to drive them on reset, with no idea what that are connected to.
 

Offline DavidDLCTopic starter

  • Frequent Contributor
  • **
  • Posts: 755
  • Country: us
Re: ATMega16 weird behavior
« Reply #8 on: June 27, 2022, 04:36:59 pm »
The problem is that he copied the bootloader from somewhere else and didn't check anything on it
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3359
  • Country: nl
Re: ATMega16 weird behavior
« Reply #9 on: June 30, 2022, 09:57:29 pm »
The problem is that ...

And another problem is that bootloader leaves the processor in some intermediate and thus unknown state. The proper way to exit a bootloader is by a hard reset, for example by enabling the watchdog and let it timeout on purpose.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf