Show Posts
Pages: [1] 2
1  Using Arduino / Microcontrollers / Re: Trying to run Arduino on an ATmega32M1. Compiles, uploads, but doesn't run. on: September 07, 2014, 10:19:21 pm
Coding Badly, I too like engbedded's calculator.  Even though it seems like the suggested default fuse settings for the ATmega32M1 is wrong on that site, I like how easy it is to visualize and manipulate the fuse settings there.

I have set the board.txt's setting for the microprocessor's speed to 1MHz (1000000L).  In my original post I do show a setting of 8MHz, but that was because I had changed it just in case something in the fuses had been changed and the microprocessor was looking for a different speed.  With you reminding me concerning reading the fuses via avrdude, I was able to confirm that the chip is still expecting 1MHz.  Thank you.
2  Using Arduino / Microcontrollers / Re: Trying to run Arduino on an ATmega32M1. Compiles, uploads, but doesn't run. on: September 07, 2014, 10:14:23 pm
According to the datasheet (http://www.mouser.com/ds/2/36/doc8209-242488.pdf) and with the help of the fuse calculator here: http://www.engbedded.com/fusecalc/.

Low Fuse--62:
CKDIV8 is set = microprocessor is running at 1/8th of clock--1MHz
CKSEL3..0 is 0010 = the internal 8MHz resonator
SUT1..0 is 10 = 20clock cycle +65ms startup time

High Fuse--D9:
RSTDISBL is not set = RESET pin is to be used as a RESET pin!
DWEN is not set = the RESET pin is not used for debugging
SPIEN is set = Serial programming and Data downloading is enabled
WDTON is not set = Watchdog time is not always on
EESAVE is not set = EEPROM memory is not preserved through chip erase
BOOTSZ1..0 is 11 = Boot size is 256 words, 4 pages
BOOTRST is not set = Upon reset the application is started

Extended Fuse--FF:
PSCRB is not set =  All PSCOUT pins are normal ports upon reset
PSCRVA is not set = not applicable with PSCRB not set
PSCRVB is not set = not applicable with PSCRB not set
BODLEVEL0..2 is 111 =  Brown Out Detection Level is disabled

engbedded's calculator is stating that the default settings for the ATmega32M1 is:
Low Fuse--0x41, High Fuse--0xD9 & Extended Fuse--0xF9

According to pages 276 & 277 of the datasheet though, this seems to be in error.  The default seems to be:
Low Fuse--0x62, High Fuse--0xD9 & Extended Fuse--0xFF

It looks like the present fuse settings on my chips only deviate from the default settings in the High Fuse where it comes to the Boot Size (BOOTSZ1..0).  My chips are at 11 so the smallest boot size of 256 words whereas the default is a setting of 00 so the largest boot size of 2048 words.  Since I'm not using a bootloader would this matter?  Either way the Application Flash section starts at memory address 0x0000 (page 270) and since the BOOTRST bit is not set in the High Fuse, the application should be started upon reset.

What do you think?  Would it hurt to go back to default settings (according to the datasheet, not engbedded's suggested setting)?  Do you see anything in the fuse settings that would keep the uploaded application from loading?
3  Using Arduino / Microcontrollers / Re: Trying to run Arduino on an ATmega32M1. Compiles, uploads, but doesn't run. on: September 07, 2014, 03:16:58 pm
Coding Badly, I forgot about being able to read the fuses via avrdude.  Thanks.  Here is what I got off the chip:

lfuse: 0x62
hfuse: 0xdf
efuse: 0xff
lock: 0x3f

Now I'm going to look up what that means!
4  Using Arduino / Microcontrollers / Re: Trying to run Arduino on an ATmega32M1. Compiles, uploads, but doesn't run. on: September 06, 2014, 01:47:20 pm
Coding Badly, I do have a 10K pull-up resistor on the Reset pin of the custom board and I've added one to the bare chip setup. 
5  Using Arduino / Microcontrollers / Re: Trying to run Arduino on an ATmega32M1. Compiles, uploads, but doesn't run. on: September 06, 2014, 06:15:05 am
I would also like to mention that I have gotten the ATmega32M1 to respond at one point--sort of.  Back when I first had just the code for adding the ATmega32M1 to the avrdude.conf and the board.txt files, I was able to compile, upload, and run the standard "Blink" sketch.  It wasn't driving the right pin, but using my LED & test lead, I was able to figure out which pins it was driving.  It was weird though.

If I set the code in the standard "Blink" sketch to:
Code:
int led = 13;
then it would drive physical pin PB5.

If I set the code to drive pins 0, 1, 2, 3, 4, 5, 6, 7, 16 or 17 then it would drive physical pin PD0.

If I set the code to drive pins 12, 14, or 15 then it would drive physical pin PB4.

If I set the code to drive pins 8, 9, 10, or 11 then it would drive physical pin PB0.

At that time, I was happy to at having code compile and upload without errors and I was at least blinking something, even though it was the wrong pins and in such a weird way.  I assumed that the weird behavior was because a specific "pins_arduino.h" had not been written for the ATmega32M1.  So I set about to write my own "pins_arduino.h" for the ATmega32M1.  Since then I haven't been able to "blink" any of the pins.  I've tried to go back and recreate the first situations again, but to no avail.  I've tried with a clean install of Arduino 1.0.5 and the standard "pins_arduino.h" and still to no avail.
6  Using Arduino / Microcontrollers / Re: Trying to run Arduino on an ATmega32M1. Compiles, uploads, but doesn't run. on: September 06, 2014, 06:02:07 am
Attached is a close up of the custom board I made for testing the ATmega32M1.
7  Using Arduino / Microcontrollers / Re: Trying to run Arduino on an ATmega32M1. Compiles, uploads, but doesn't run. on: September 06, 2014, 06:01:05 am
Attached is a close up picture of the ATmega32M1 bare chip attached to the RedBoard ISP.
8  Using Arduino / Microcontrollers / Re: Trying to run Arduino on an ATmega32M1. Compiles, uploads, but doesn't run. on: September 06, 2014, 05:58:30 am
Westfw,  I've tried setting both pins PD1 and PB1 HIGH.  I use PD1 because my built in LED on my custom board for the ATmega32M1 is attached to that pin.  I've tried PB1 because that is the pin used in Coding Badly's code and I prefer to use other people's code as is without introducing any of my code first so that my simple brain doesn't mess up what they've already done!

So my test process is:
I will copy someone else's code (like Coding Badly's) and use it as is and test the physical PB1 pin (because that is the one in his code) with an LED & test lead (as shown in the picture).  I then test all the other physical pins with the LED & test lead while still running the same code.  Then I change the code so that it points to pin PD1, and check to see if the built in LED "blinks."  If still unsuccessful, then I test all the other pins with the LED & test lead while still running the same code.  I repeat the same process with the bare chip as shown in the attached pictures.

Yes, I do have the ATmega32M1 (three of them!).  Yes it's naming convention is confusing!!  It is not pin compatible with a chip like the ATmega32U4 either!  It has been a bit frustrating searching the internet for info and other people's work concerning the ATmega32M1 because all the other "ATmega32..." chips come up as hits too (like that ATmega328, ATmega328p, etc.).

Attached is a picture of my test setup with the RedBoard as the ISP, LED & test lead, and the ATmega32M1 bare chip.
9  Using Arduino / Microcontrollers / Re: Trying to run Arduino on an ATmega32M1. Compiles, uploads, but doesn't run. on: September 06, 2014, 05:45:53 am
Coding Badly, I am not using a bootloader but just using a RedBoard (Uno) from Sparkfun.com as an Arduino ISP.  If you know of a bootloader for the ATmega32M1, please let me know! smiley

I have tried waiting several seconds for each pin tested.  I've also tried deleting the delays and taking out the part of the "Blink" sketch that sets the pin "LOW."  This way, I'm just setting the pin (whichever one I'm testing for) to be "HIGH."

I'm certain that the LED on my custom board (see pictures attached in next post) is attached to pin PD1 (referred to as pin #9 in my "pins_arduino.h" file).  I've also tried pin PB1, because that is the pin used in your code.

Whether running your test code, or my test code, upon uploading any sketch, I check every physical pin with an LED and test lead to see if I'm accidentally setting a different physical pin "HIGH!"
10  Using Arduino / Microcontrollers / Re: Does anyone have the files to run Arduino on an ATmega32M1? on: September 06, 2014, 04:37:47 am
Riva, thanks for the inquiry.  I've tried my own code, but something isn't quite right.  I cannot get an LED to blink!  That side of the attempt can be found in this thread:
Code:
http://forum.arduino.cc/index.php?topic=265078.0
.  That is why I was asking if anyone else out there had the code already written.
11  Using Arduino / Microcontrollers / Re: Trying to run Arduino on an ATmega32M1. Compiles, uploads, but doesn't run. on: September 05, 2014, 11:11:12 pm
Okay, Coding Badly,  I just tried your latest suggestion, coping and pasting the code with the "int main void" in it.  Same as before: compiles and uploads without error, but no blink. smiley-sad
12  Using Arduino / Microcontrollers / Re: Trying to run Arduino on an ATmega32M1. Compiles, uploads, but doesn't run. on: September 05, 2014, 09:28:50 pm
westfw, I had never looked up an .elf file before, but I've attached the latest .elf file from trying Coding Badly's code.
13  Using Arduino / Microcontrollers / Re: Trying to run Arduino on an ATmega32M1. Compiles, uploads, but doesn't run. on: September 05, 2014, 09:22:08 pm
Jiggy-Ninja, I greatly appreciate your contributions as well. smiley  Thanks for the heads up concerning the HardwareSerial.h file.  I had not caught that.  I will definitely look into it and adapt.  Thank you very much.
14  Using Arduino / Microcontrollers / Re: Trying to run Arduino on an ATmega32M1. Compiles, uploads, but doesn't run. on: September 05, 2014, 09:19:46 pm
Coding Badly,  thanks for the suggestion concerning manipulating the pins directly via the registers.  I too had tried something similar, but my code wasn't a efficient as yours! smiley  I tried it exactly like you posted (copy and pasted it).  It compiled and uploaded without a hitch, but no blink.  I then altered it to DDRD, DDD1, PIND,  PORTD & PORTD1, just to try a different pin.  Same result.
15  Using Arduino / Microcontrollers / Re: Trying to run Arduino on an ATmega32M1. Compiles, uploads, but doesn't run. on: September 05, 2014, 07:55:34 pm
Jiggy-Ninja, yes, I've tried it with:
Code:
atmega32m1.build.variant=atmega32m1
since that is the name of the folder under variant.  Before I posted the code, I had tried it with "standard" again hoping that even if the pin assignment was wrong with the "standard" pins_arduino.h file that at least one pin some where on the chip would show signs of going HIGH! smiley
Pages: [1] 2