Pages: [1]   Go Down
Author Topic: ATMEGA 1280 and 1284 - UART differences  (Read 649 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 142
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello

can anyone help me here ??

I have been successfully using Matt Hertels fantastic DMX transceiver software for quite a while now on numerous Arduinos, but now I want to put it onto a Mighty1284 (atmel1284)... it doesnt output any serial and I think its something to do with the Byte address names that are used that point to registers, I have looked at the library CPP & H files till my eyes bled and cant spot anything wrong, so I am guessing there must be a file somewhere in the Arduino files that equates the Byte names to a physical register address... Can anyone tell me where it is ??

Also does the IDE know to use a different set of registers when a different board is selected from menu ?

Thanks in advance. Bob
Logged

while (z--) { snore; }

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27115
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

1280 has a lot more ports than a 1284 (100 pin part vs 44 pin part in TQFPs).
1280 has 4 serial ports, 1284  has 2.
I haven't dug into the other stuff.  Do you have the mighty1284 core files installed?
https://github.com/maniacbug/mighty-1284p
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2916
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you have a link to said library? Which serial port are you trying to use?
Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 53
Posts: 1793
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
does the IDE know to use a different set of registers when a different board is selected from menu ?

After the "core" files are installed from the link CrossRoads provided, then the answer is Yes

Ray
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 134
Posts: 6763
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It looks to me as though the 1284 names are the same as 1280/2560 names, so the current code SHOULD be working.
Are you sure you're connected to the correct serial pins?  Both the 1280 and 1284 have multiple serial ports, and the DMX code as the ability to use either usart0 or usart1.  It should be covered by this code in DMXSerial.cpp:
Code:
#elif !defined(DMX_USE_PORT1) && defined(USART0_RX_vect)
// These definitions are used on ATmega1280 and ATmega2560 boards
// like the Arduino MEGA boards
#define UCSRnA UCSR0A
#define TXCn   TXC0
  :
#elif defined(DMX_USE_PORT1) || defined(USART1_RX_vect)
// These definitions are used for using serial port 1
// on ATmega32U4 boards like Arduino Leonardo, Esplora
// You can use it on other boards with USART1 by enabling the DMX_USE_PORT1 port definition
#define UCSRnA UCSR1A
#define TXCn   TXC1
#define UCSRnB UCSR1B
  :
Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2916
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It looks to me as though the 1284 names are the same as 1280/2560 names, so the current code SHOULD be working.
Are you sure you're connected to the correct serial pins?  Both the 1280 and 1284 have multiple serial ports, and the DMX code as the ability to use either usart0 or usart1.  It should be covered by this code in DMXSerial.cpp:
Code:
#elif !defined(DMX_USE_PORT1) && defined(USART0_RX_vect)
// These definitions are used on ATmega1280 and ATmega2560 boards
// like the Arduino MEGA boards
#define UCSRnA UCSR0A
#define TXCn   TXC0
  :
#elif defined(DMX_USE_PORT1) || defined(USART1_RX_vect)
// These definitions are used for using serial port 1
// on ATmega32U4 boards like Arduino Leonardo, Esplora
// You can use it on other boards with USART1 by enabling the DMX_USE_PORT1 port definition
#define UCSRnA UCSR1A
#define TXCn   TXC1
#define UCSRnB UCSR1B
  :
There are multiple versions of the library [duh, imagine that!], and some show the lines above  ....
http://www.mathertel.de/Arduino/DMXSerial.aspx

and others do not ....
https://github.com/elperepat/DmxSerial/commit/52b9f80c2af9849e430951a2177b4b2b39d51260
https://github.com/elperepat/DmxSerial

I've checked out about a dozen libraries now for compatibility with 1284 chips (which is what I use in 90% of my projects now), and maybe half of them work ok, depending on specifically what the .h and .cpp files specify about the chips. Some are easily patched to work, others are a royale PITA to get to work.

With the 1284, it also depends on which board is selected at compile-time as they all have somewhat different header pinouts per the pins_arduino.h file. The following posts have some info on this,
http://forum.arduino.cc/index.php?topic=192115.msg1420845#msg1420845
http://forum.arduino.cc/index.php?topic=192115.msg1422603#msg1422603
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 142
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for all your replies, lots to think about !!

I am also trying a atmega644 (half mem 1284) and I have looked at the data sheet for that and the register names are the same too, I ma using the right ports etc, I am very used to using Matt Hertels code, I was even trying to get it working with Atmega8_16's but with little success (this may be all the for the same reason - inexperience !)

ManicBug, yes I am using your mighty code, thank you
Logged

while (z--) { snore; }

Pages: [1]   Go Up
Jump to: