Hi, I'm trying to get an arduino sketch running on an Atmega32 16Pu chip with an external 16mhz clock, everything seems to be working, including I2C communications with a nano, but the hardware serial i can't get up and running.
If i run this on the nano, i can read it over the USB's virtual COM port.
So I tried the standalone chip with a max232 and a physical COM port, and on a scope i can see data, however, the computer doesn't seem to be getting anything.
Shorting the RX and TX pin on the max232 (without the arduino attached) results in an echo, as to be expected, so the max232 circuit is working. However, i can not get the atmega32 16pu chip to communicate with the pc.
I've read somewhere that HardwareSerial.cpp needs to be modified with some extra defines. However, those defines get never defined with my boards.txt selection: (I'm not entirely sure how the defines relate to the settings in boards.txt either, is it the string from build.board padded with __ on both sides?)
I've put together a core where most AVR DIP-40s (including ATmega32) are supported. Just remember to burn the bootloader before you upload the code.
I've had no problems using Serial.print with the ATmega32
I've changed the low fuses in my download from 0xff to 0xf7 for the faster clock 1284/644/324/164 chip settings.
There've been much less complaints over software installs with Full Swing Crystal Oscillator selected. There's a whole multi page long discussion in the forum over that.
I haven't actually thought of using the full swing oscillator option. Could you please link to the post you are mentioning? I'd like to run some tests does this affects the power consumption?
Yes, a core is all the basic libraries that's used to compile code + the bootloader and pin definitions. Since the ATmega32 isn't officially supported by the Arduino team, you'll need to add a core that makes the ATmega32 work with the Arduino IDE.
But this ATmega of yours, have you loaded it with a bootloader? You're not able to upload a sketch to it with a USB to serial adapter. You can either upload the code using a programmer (USBasp, USBtinyISP) by holding shift while you upload your sketch, or burn the bootloader to be able to upload using a USB to serial adapter
i'm uploading with an ISP, but the programmer (ArduinoISP) isn't in the list of your programmers.
Am i supposed to use that core on top of the default arduino core folder? or replace it?
Putting it in Documents\Arduino\hardware... doesn't seem to be doing anything good:
Warning: platform.txt from core 'MightyCore' contains deprecated recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}", automatically converted to recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}". Consider upgrading this core.
Could not find boards.txt in C:\Users\stino\Documents\Arduino\hardware\avr\bootloaders. Is it pre-1.5?
Could not find boards.txt in C:\Users\stino\Documents\Arduino\hardware\avr\cores. Is it pre-1.5?
Could not find boards.txt in C:\Users\stino\Documents\Arduino\hardware\avr\libraries. Is it pre-1.5?
Could not find boards.txt in C:\Users\stino\Documents\Arduino\hardware\avr\variants. Is it pre-1.5?
And i can't upload the bootloader with the default arduino core because the checksum doesn't seem to be what avrdude expects, but no clue where it gets the checksum from, it's not in boards.txt.
EDIT: seems like i need to unzip it to hardware<something>\ not just hardware.
Result is: it compiles, it uploads, my TX led blinks but no data on my COM port, not even random noise.
The directory should be /Users/[username]/Documents/Arduino/hardware/MightyCore-master
The error saying that the core should be updated is supposed to be there. The error message only appear in Arduino IDE 1.6.6. If I fix the error, the core wouldn't be backwards compatible with 1.6.5 and older. (stupid, indeed!)
If you got an LED on the TX pin and it flashes when the program is running, it means that the Serial.print are working just fine. Try hooking up a logic analyzer or an oscilloscope to see what actually happens on that pin. Maybe you got a bad driver on your PC? What kind of USB to serial adapter are you using?
The USB-Serial adapter seems to be working if I test it with the Arduino Nano. Also, the LED-flashing frequency/duty cycle seems to be different. With the Nano it's almost constant-on while with the Atmega32 I can see it blink, although fast, still slow enough to see that they are individual pulses.
So I'm guessing somehow that 9600 isn't 9600, but how much slower I can't tell. The scope I have is an analog one, so, no memory to capture the bittrain.
then I'm afraid I don't know whats wrong.
I also got an ATmega32A lying around, and I hooked it up to my test board.
Selected 16MHz, and burned the bootloader. Uploaded this sketch with an FTDI adapter:
The CKSEL register, how does it get set for external? is that the bootloader's job? Becaue there's no bootloader on the chip, just directly programmed via ICSP.