atmega 1284 help with pinnout

Hy i have a problem with my atmega 1284 (got 2 of this chips)

I managed to hook one up and burn a bootloader on it, a sanguino 16mhz for 1284p.

For now all is working ok i am using the folowing pinnout for the sanguino :

// ATMEL ATMEGA644P / SANGUINO
//
//                     +---\/---+
// 0  INT0 (D 0) PB0  1|        |40  PA0 (AI 0 / D31)	31
// 1  INT1 (D 1) PB1  2|        |39  PA1 (AI 1 / D30)	30
// 2  INT2 (D 2) PB2  3|        |38  PA2 (AI 2 / D29)	39
// 3   PWM (D 3) PB3  4|        |37  PA3 (AI 3 / D28)	28
// 4   PWM (D 4) PB4  5|        |36  PA4 (AI 4 / D27)	27
// 5  MOSI (D 5) PB5  6|        |35  PA5 (AI 5 / D26)	26
// 6  MISO (D 6) PB6  7|        |34  PA6 (AI 6 / D25)	25
// 7   SCK (D 7) PB7  8|        |33  PA7 (AI 7 / D24)	24
//               RST  9|        |32  AREF
//               VCC 10|        |31  GND 
//               GND 11|        |30  AVCC
//             XTAL2 12|        |29  PC7 (D 23)		23
//             XTAL1 13|        |28  PC6 (D 22)		22
// 8  RX0 (D 8)  PD0 14|        |27  PC5 (D 21) TDI	21
// 9  TX0 (D 9)  PD1 15|        |26  PC4 (D 20) TDO	20
//10  RX1 (D 10) PD2 16|        |25  PC3 (D 19) TMS	19
//11  TX1 (D 11) PD3 17|        |24  PC2 (D 18) TCK	18
//12  PWM (D 12) PD4 18|        |23  PC1 (D 17) SDA	17
//13  PWM (D 13) PD5 19|        |22  PC0 (D 16) SCL	16
//14  PWM (D 14) PD6 20|        |21  PD7 (D 15) PWM	15
//                     +--------+
//

had to wrap it into code to look good :wink:

It tooked me a wile to figure out the pins (number ones) but well i think i made it on the left side are the pin numbers wich works in arduino eg pin 0 is the pin pb0 , pin 14 is PD6 and pin 24 is PA7. (correct me if i am wrong)

all works ok except few of them :

18,19,20,21 (PC2 , PC3 , PC4 , PC5 ) can you please tell me can i use this pins as digital outputs or inputs? i am realy short on pins and this one do not work.

the blink code compiles but i do not get anything like the desired effect on pin 18, all i get is a faded led even if i connect to pin 19 or 20 or 21 with the same blink sketch on pin 18. ( i hooked up to power the other chip without bootloader and is dooing the same thing faded led without any sketch on it so it must be something hardware).

please tell me what does TCK , TMS ,TDO and TDI stands for ?

thanks and please bare with me and excuse my poor english.

All pins are usable as digital input & and output.

TCK , TMS ,TDO and TDI are for connecting a JTAG device if you have one.
There is a fuse bit associated with JTAG, you may need to re-program that bit.

See Table 26-4, page 298 of the datasheet.
High Fuse byte, bit 6, is the the JTAG enable bit, and it is enabled by defualt.

Hy, thanks for the answer unfortunatly i did not find the page u were talking in the datasheets i found :frowning:

but i did searched a bit afther the fuse stuff and i found this fuse calculator :

http://www.engbedded.com/fusecalc

but somehow i do not know exactly how to use it and wich options to chose from...

so i found another post of yours http://arduino.cc/forum/index.php/topic,131254.0.html

and you have atached a 1284boards to try.txt where i found this settings for bobuino mega1284

##############################################################

mighty_1284.name=1284 Bobuino
mighty_1284.upload.protocol=arduino
mighty_1284.upload.maximum_size=130048
mighty_1284.upload.speed=115200
mighty_1284.bootloader.low_fuses=0xff
mighty_1284.bootloader.high_fuses=0xde
mighty_1284.bootloader.extended_fuses=0xfd
mighty_1284.bootloader.path=optiboot
mighty_1284.bootloader.file=optiboot_atmega1284p.hex
mighty_1284.bootloader.unlock_bits=0x3F
mighty_1284.bootloader.lock_bits=0x0F
mighty_1284.build.mcu=atmega1284
mighty_1284.build.f_cpu=16000000L
#bobuino.build.core=arduino:arduino
mighty_1284.build.core=standard
mighty_1284.build.variant=bobuino

##############################################################

can you please confirm me if this settings are corect, will it disable jtag?

will this work if i modify the file boards.txt in c:\arduino\hardware\sanguino\boards.txt and burn again the bootloader to the chip ?

now i have this in boards.txt :

##############################################################

atmega1284.name=Sanguino W/ ATmega1284p 16mhz

atmega1284.upload.protocol=stk500
atmega1284.upload.maximum_size=131072
atmega1284.upload.speed=57600

atmega1284.bootloader.low_fuses=0xFF
atmega1284.bootloader.high_fuses=0x9A
atmega1284.bootloader.extended_fuses=0xFF
atmega1284.bootloader.path=atmega
atmega1284.bootloader.file=ATmegaBOOT_168_atmega1284p.hex
atmega1284.bootloader.unlock_bits=0x3F
atmega1284.bootloader.lock_bits=0x0F

atmega1284.build.mcu=atmega1284p
atmega1284.build.f_cpu=16000000L
atmega1284.build.core=arduino
atmega1284.build.variant=standard

thanks.

This is what I use from the standard mighty1284 addition to the IDE.

bobuino.name=Bobuino
bobuino.upload.protocol=arduino
bobuino.upload.maximum_size=130048
bobuino.upload.speed=115200
bobuino.bootloader.low_fuses=0xff
bobuino.bootloader.high_fuses=0xde
bobuino.bootloader.extended_fuses=0xfd
bobuino.bootloader.path=optiboot
bobuino.bootloader.file=optiboot_atmega1284p.hex
bobuino.bootloader.unlock_bits=0x3F
bobuino.bootloader.lock_bits=0x0F
bobuino.build.mcu=atmega1284p
bobuino.build.f_cpu=16000000L
#bobuino.build.core=arduino:arduino
bobuino.build.core=standard
bobuino.build.variant=bobuino

You may have looked at the summary datasheet, vs the complete datasheet:

Table 27-4 on page 299
Looks like its been updated, this is the version, May 2012.

This code disables the JTAG on port C:

uint8_t tmp = 1<<JTD; // Disable JTAG
MCUCR = tmp; // Disable JTAG
MCUCR = tmp; // Disable JTAG

CrossRoads:
This is what I use from the standard mighty1284 addition to the IDE.

crossraods, can i ask where that bootloader is from that you used with that and what port it uses?

This one, sketch downloads on Serial 0.
I just bootloaded another blank part from Atmel AVR ISP MKii & loaded a sketch with FTDI Basic - worked first time.

optiboot_atmega1284p.hex (1.47 KB)

im trying to get arduino0022 blink to run with m1284 (not p). with so many bootloaders, conf and board files there are thousands of combinations. my head is spinning.

using your hex file and board.txt entry (m1284p) i get: "'output' not declared in this scope"

with the above mighty1284 board.txt entry (m1284) i get: "atmega1284 supported for assembler only"

i have updated avrdude.conf with m1284 and m1284p entries. any idea what im doing wrong?

john1993:
im trying to get arduino0022 blink to run with m1284 (not p). with so many bootloaders, conf and board files there are thousands of combinations. my head is spinning.

Note that earlier parts of this thread are referring to 1.x board.txt entries.

i have updated avrdude.conf with m1284 and m1284p entries. any idea what im doing wrong?

The updated 5.11svn avrdude that I gave you should have already had 1284p support in it.

There are several differing pinouts for the 644/1284 processors that are controlled by the core code.
Actually it is by the tables in data arrays stored in flash that changed depending on which core you have.

While I wasn't a fan of several of things that the Arduino team in Arduino 1.0
Arduino 1.x does have a mechanism that makes changing pin mappings easier.
Arduino 1.x allows you to specify the core and the variant of that core separately
in the boards.txt file.
This is very useful for the 644/1284 "Sanguino" core because of the different pin mappings
for the same core code.
If I were you, I'd bite the bullet and jump up to Arduino 1.x and then you can more easily
adjust things as needed.

--- bill

ive had 0102 running for some time now but use 0022 on this machine for legacy reasons. the avrdude i got from you is running from command line (no ide) and solved all my xp assembler development issues. but not being used for arduino because its not needed. im using stock 0022 atm with whatever minimal mods are being suggested. cant get m1284 running though.

so youre thinking if i use the bootloader i just got from bob and add his bobuino boards.txt entry with 0102 then everything will work? ill try that.

btw this is for a bobuino board i just got hold of and unrelated to the other project.

ok, i went into STOCK 0102 and added bobs "mighty1284" to boards.txt then added 1284 and 1284p entries to its avrdude.conf. same error as 0022: "'output' was not declared in this scope"

btw as we discussed in the other thread m1284 support was not present in your avrdude. i had to go in and add that.

edit: further inspection shows "avrdude unknown mcu: atmega1284" so looks like something wrong with conf or board files. i attached copies:

avrdude.conf (574 KB)

boards.txt (14.9 KB)

This rapidly turning into a thread hi-jack.
Another thread would probably be better to resolve this.

john1993:
ok, i went into STOCK 0102 and added bobs "mighty1284" to boards.txt then added 1284 and 1284p entries to its avrdude.conf. same error as 0022: "'output' was not declared in this scope"

Are you sure it isn't OUTPUT vs output.
It makes a difference.
And I'm assuming that there are other/additional error messages or information as well.
Make sure to build the code with verbose enabled in the IDE so it spits out everything
including the commands so you can see the include paths to make sure that the proper
include paths are being used.

It sounds like Arduino.h (arduino 1.x) or wiring.h (pre 1.x arduino) is not being found
which could mean that the 1284 core is not installed in the proper location
(in the Arduino tree hardware directory or under your sketch/hardware directory)

--- bill

1284 core? maybe we have found the root of the problem. havent seen mention of "cores" so far and have not installed any. as i mentioned its a stock 0102 install. is it the standard download insufficient? im half way though the "1284 end to end" megatread (many hours of reading) and no indication of how to actually get a m1284 running. lots on pcb design and eagle files. is there another that might give a hint on proper install for m1284?

maybe littlej is having similar problems with no resolution so might not be too hijacked but i will start a new thread. i hate to clutter the forum with repeat issues. is there a thread showing how to get m1284 going in the ide? (bootloader, board.txt, avrdude.conf, "cores", etc)

thanks to you and to bob for the loader it went much smoother than i ever would have expected. in less than half a minute after dowloading that zip file the led was blinking. moving to arduino0102 and that link was the key. this should be a sticky in this forum.

i cant imagine massimos group can ignore this chip any longer. huge loss in profit once people wake up to the cost benefit of the m1284. i suspect before the end of the year this core will be part of the standard distribution. thanks again.

john1993:
i cant imagine massimos group can ignore this chip any longer. huge loss in profit once people wake up to the cost benefit of the m1284. i suspect before the end of the year this core will be part of the standard distribution. thanks again.

I doubt it. Have you seen support for any other board not made by "Arduino Inc" in a Arduino s/w release?

That is why you are already seeing forks.
mpide,
the guy that forked the ide to get lots of fixes and really nice feature updates into the windows IDE.
Paul with his teensy3.
(I have several personal updates I do to the "standard" core code to make the code smaller and faster for my builds)

While the source may be open, and it is possible to extend an Arduino s/w release with new core support,
the process of getting things into the official release is still very closed.

--- bill

While the source may be open, and it is possible to extend an Arduino s/w release with new core support,
the process of getting things into the official release is still very closed.

Yes it is frustrating at times. Several years back I got a 644p based board and installed the files needed to make the IDE work with it (around version 11 or 12 I think), but every time there was a new IDE release I would have to redo the mods and after a while I just stopped bothering. I understand the newer versions of the IDE make that effort easier but I keep misplacing the links for the detailed information steps required for actually adding a new board to the IDE.

But I can also kind of see their position too. If they indeed provided direct support to any and all 3rd party 'arduino' boards using different processors or clock speeds with their 'official' offerings, would they then not end up 'owning' all the support issues, bug reports, request for minor changes, etc, they included with the official release including the bootloaders? Sounds like a support headache they would probably like to avoid.

Lefty

what i meant was massimo should come out with an m1284 board himself. this would establish a standard pinout which, from browsing the "end to end" thread, seems to account for 2/3rd of the difficulties with this chip. the current thread being another example. the remaining 3rd may be a result of arduino deciding to abandon atmel pin designations in favor of arbitirary numbers but not much to be done about that at this point. however producing a new "official" 1284duino might force some of these wild and crazy innovators (present company excepted of course lol! ) to use more reasonable pinouts.

What would you consider a reasonable pinout?
For my '1284P designs, I tried to select the pins for shield compatability:
D0, D1 for serail(0),
D13-12-11-10 for SPI,
A4/A5-D18/D19 for I2C
The rest just followed from what was open.
That seemed reasonable to me, vs having to hunt around for Serial tie-ing up these pins, SPI tie-ing up those, and I2C yet somewhere else.
So more Uno like than Mega like.

Everything is a tradeoff.
The "standard pinouts" do not take full advantage of available pins. The Leonardo for instance, a few more IO pins could hve been made availabe in my opinion.
Fortunately the open source nature allows one to come up with a form factor & pinout, and if catches on, great, and if not, other things are always possible.

with only a few hours experience imo the bobuino has reasonable pinout and if adruino company does produce a board hopefully they will adopt it. ive read the whole "end-to-end" thread now and the process for choosing pins made a lot of sense but it wasnt always like that. for example some designs had the led on pd7 instead of pd5 which caused me some confusion ruunning the official blink demo. and as mentioned using uart1 instead of uart0 prevents use of 2 very useful direct ints on those pins. the uart0 pins do not have any more useful function and make a better boot interface. i realize there were rare and early problems with uart0 but this is now. and the story behind the extra adc pin selection was interesting too. as a hardware engineer i understand picking and choosing pinouts can be the secret to success and glad your board turned out so well. anyway thanks again to you guys and maniac bugs effort for helping me get this running.