Show Posts
Pages: [1] 2 3 ... 14
1  Using Arduino / Microcontrollers / Re: component of microcontroller on: December 24, 2013, 10:07:06 pm
The mega8u2? It acts as a virtual com port. Lets you talk to the arduino / upload code with a standard usb connection.
2  Using Arduino / Microcontrollers / Re: Problem uploading code with Optiboot on: December 23, 2013, 12:05:16 am
Ah, I didn't know that the bootloader couldn't write fuses, that clears it up. By "the watchdog is disabled" I meant that the watchdog fuse wasn't set, so I doubt that it's causing a problem. I guess I'll just suck this chip off and put a new one in since this has to be finished by tomorrow. I've never had a chip fail like this before though, it's quite strange.
3  Using Arduino / Microcontrollers / Re: Problem moving projects from Arduino Uno to Atmega328p on a breadboard on: December 22, 2013, 11:51:41 pm
Yes, you should have decoupling caps next to every chip. Try measuring the voltage of the wallwart and of the 5 volt rail while the program is running, if either voltage drops a lot when the LEDs turn on then you know you have power problems.
4  Using Arduino / Microcontrollers / Re: Problem uploading code with Optiboot on: December 22, 2013, 10:45:42 pm
Okay so I went ahead and burned the regular optiboot and then uploaded my code at 57600 baud. It wrote and verified properly, but it failed when trying to burn the fuses. Now for some reason the MCU seems to restart every 80 ms. WTF? I can still upload code and change the fuses with the dragon, but the code only runs for 15 ms then it does nothing for 65 ms, and then restarts.
Anyway, I tried again on another chip and it works fine, but I still can't write any fuses. I probably won't need to for firmware updates though. Question now is, how do I unbrick the first chip? What in the world would cause the code to run for 15 ms, idle for 65 ms, and then restart? The watchdog is disabled if that could have anything to do with it.
5  Using Arduino / Microcontrollers / Re: Problem uploading code with Optiboot on: December 22, 2013, 08:41:59 pm
I admit that I don't really know what I'm doing here and I've never messed aroud with makefiles so I thought editing the source was the way to go. Basically I just make a new project in atmel studio and threw all of the optiboot files in. Then I added
#define F_CPU 7900000L
#define BAUD_RATE 2400
  to the top of optiboot.c and and removed
#if (F_CPU/BAUD_RATE) > 280 // > 57600 for 16MHz
#ifndef SOFT_UART
#define SOFT_UART
to use the hardware uart.. I also changes a few of these
#elif defined(__AVR_ATmega328P__)
to this
#elif (defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__))
so that it would compile for a 328. After the changes I just let atmel studio compile it for me (it ends up at 766 bytes, but that's good enough for me). Here is what AS6 says it's doing to compile:
avr-gcc -funsigned-char -funsigned-bitfields -DDEBUG  -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega328 -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)"
to link:
avr-gcc -Wl,-Map="$(OutputFileName).map" -Wl,--start-group -Wl,-lm  -Wl,--end-group -Wl,--gc-sections -mmcu=atmega328
and to assemble:
avr-gcc -Wa,-gdwarf2 -x assembler-with-cpp -c -mmcu=atmega328 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -Wa,-g
I used my AVR dragon to burn the bootloader and to burn the BOOTSZ1, BOOTSZ0, and BOOTRST fuses. I have a feeling that the problem lies in the fuse settings, or the fact that my file is over 512 bytes, while optiboot expects itself to be less that 512 bytes (does it?). If you could provide me with a "correct" hex file for an atmega328 running at 8 MHz (7.9 to be exact) at a baud rate from 2400 to 115200 baud that would awesome.
6  Using Arduino / Microcontrollers / Re: Problem uploading code with Optiboot on: December 22, 2013, 09:15:58 am
Yeah, that's pretty much what I figured. I guess they just wanted to save a few bytes.
7  Using Arduino / Microcontrollers / Re: Problem moving projects from Arduino Uno to Atmega328p on a breadboard on: December 22, 2013, 07:46:02 am
Did you put decoupling caps (100 nF) next to the MCU as well as some bigger (10 uF) caps on the power rail? sounds like you might be browning out. Are there any heavy loads being driven from the same rail that's powering your MCU?
8  Using Arduino / Microcontrollers / Problem uploading code with Optiboot on: December 22, 2013, 07:11:40 am
My current project uses an atmega328 and will need to have updated firmware uploaded though the serial port. I figured optiboot should work fine for this, so I modified the optiboot source for an atmega328 at 8 MHz and 2400 baud (just for testing). I made an rs232 to TTL serial converter with transistors and verified that I got clean edges, burned the bootloader with an AVR dragon, and used avrdude with "-c arduino -p m328 -P COM1 -b 2400 -F -v -U ........" to upload the code.
The first thing that went wrong is that the chip was recognized as an atmega328P (device signature 0x1e950f), whereas I'm using an atmega328; I probably missed something while modifying optiboot, but the chips are virtually identical so added '-F" to avrdude. After that everything went fine, but as soon as avrdude started verifying the code I got a verification error, " first mismatch at byte 0x0002 0x35 != 0x34", I tried another hex file and got a mismatch at 0x0000. Both of these upload fine with any other programmer.
I've tried baud rates from 625 up to 115200 (below 2400 doesn't work at all) and I get the same exact error, so I don't think this is caused by the internal oscillator being off. I even manually set UBBR0 (the baud rate register) in optiboot to get as close to 2400 baud as I could. I've even tried uploading to an atmega328P and I get the same problems. Do you guys have any idea what could be causing these verification errors?
9  Using Arduino / General Electronics / Re: help regulating voltage on: September 19, 2013, 11:35:58 am
Do you really only have .1 uf on tbe input of the 317? You're going to need a lot more if it's coming directly from a bridge rectifier.
10  Using Arduino / General Electronics / Re: Automotive relays diodes shorting? on: July 20, 2013, 11:09:17 am
a 12 volt coil overheats on 12 volts? Somethings gone dicky here. I see your not sure about it being a 12 volt relay. I'd recommend using 9v instead. Anything above the pull-in voltage should work.
11  Using Arduino / General Electronics / Re: Are MOSFETs really this good? on: July 20, 2013, 10:48:10 am
I've never understood the logic in using N-channel FETs on the high side of the h-bridge. If I'm using a 12v supply and I want to get 12v Vgs on the high side FETs for low resistance, wouldn't I need 24v relative to ground since the source would be at 12v when the motor is on?
12  Using Arduino / General Electronics / Re: Are MOSFETs really this good? on: July 20, 2013, 04:31:47 am
Yea, I'm on the fence between making my own driver and using a real stepper driver, but I'm ordering components off Digikey and they don't seem to have any cheap stepper motor drivers. I was also a bit concerned about the fact that those MOSFETs were only rated for 12v Vgs, so I think I'll look for some other ones. And I guess I won't be using external diodes. That's also a good idea about using the MOSFET as the flyback diode, maybe I'll try that. Thanks for all the info.
13  Using Arduino / General Electronics / Are MOSFETs really this good? on: July 20, 2013, 12:11:49 am
I've been looking for MOSFETs to build a couple h-bridges for stepper motors (rated at 0.3A), and I'm really surprised at how tiny of a MOSFET I need to drive this motor. For the p-channel MOSFETs I'm looking at these
After doing some calculations it looks like I'll get about 80m-ohms drain to source with -12v gate to source at 70 degrees C. So I should be able to push the recommended max of 2.1A through it all day without heatsinking.

Is this all correct or am I missing something? I just can't believe that this tiny thing can handle 2.1A all day long. I know for a fact that I'm leaving out switching losses, but I honestly have no idea how to calculate that. I also don't imagine it'll have a big effect when I have such a big overhead.

EDIT: A question about flyback diodes. I know it's generally recommended to include separate ones and I usually do, but what's the theory behind this? It seems to me like the internal diode in the MOSFET should be able to handle the back EMF. Maybe someone more knowledgeable than me will be able to make something of the winding inductance in relation to back EMF voltage, so here's the motor product page:
14  Using Arduino / General Electronics / Re: LED as Sensor ?in reverse or forward bias?? on: June 20, 2013, 05:21:37 pm
Very neat paper, thanks for sharing. I just might integrate a simple LED communication interface on a project I'm working on.
15  Using Arduino / Project Guidance / Re: Using an external adapter to supply voltage to a rotary encoder. on: June 14, 2013, 09:41:19 pm
Don't tempt me. I'll never get to bed if I click on that link.
Pages: [1] 2 3 ... 14