Go Down

Topic: ATMEGA 1280 and 1284 - UART differences (Read 799 times) previous topic - next topic

mcnobby

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
while (z--) { snoreEvenLouder(); }
www.smartshow.lighting - www.dmx512.lighting

CrossRoads

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
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

oric_dan

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

mrburnette

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

westfw

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: [Select]
#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
  :

oric_dan


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: [Select]
#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

mcnobby

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
while (z--) { snoreEvenLouder(); }
www.smartshow.lighting - www.dmx512.lighting

Go Up