ca
Offline
Jr. Member
Karma: 0
Posts: 62
|
 |
« on: June 29, 2012, 11:14:30 pm » |
Hey!
I can't figure out how change from default Arduino 10 (SS), 11 (MOSI), 12 (MISO), and 13 (SCK). to 4, 5, 6, 7 to match The Mighty 1284p ? Anyone ?
|
|
|
|
|
Logged
|
|
|
|
|
ca
Offline
Jr. Member
Karma: 0
Posts: 62
|
 |
« Reply #1 on: June 29, 2012, 11:40:07 pm » |
I figured out it was located in pins_arduino.h static const uint8_t SS = 4; static const uint8_t MOSI = 5; static const uint8_t MISO = 6; static const uint8_t SCK = 7; But, i still can't get any basic Ethernet examples to work, it just hang. I've tried with 4 different 1284p, no love.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 226
Posts: 14099
Lua rocks!
|
 |
« Reply #2 on: June 30, 2012, 05:58:20 pm » |
What Ethernet card/board are you using and how is it connected?
|
|
|
|
|
Logged
|
|
|
|
|
ca
Offline
Jr. Member
Karma: 0
Posts: 62
|
 |
« Reply #3 on: June 30, 2012, 11:41:57 pm » |
Nick, Pretty much straightforward set-up. It works with any atmega i have here but not the 1284p, go figure. I've tried all week.
I use an Ethernet Shield (no SD) and i power it with 3.3 v, connect the ground of course. Then, i wire pins 10, 11, 12 and 13 to the 1284p 4, 5, 6, 7 like this 10->4, 11->5, 12->6, 13->7 The 1284p operates correctly until it hit line Ethernet.begin(mac) It freeze right there.
Like i said, i do the same thing for months with other megas and it is all fine. FYI, i've also tried Jeelabs Ethercard, using ethercard library, diferents SS_pin but same problem. Again, works fine with other megas.
Thanks for the help.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 226
Posts: 14099
Lua rocks!
|
 |
« Reply #4 on: July 01, 2012, 12:19:49 am » |
Do you mean the pins on the chip? From this page: http://maniacbug.wordpress.com/2011/11/27/arduino-on-atmega1284p-4/ +---\/---+ (D 0) PB0 1| |40 PA0 (AI 0 / D24) (D 1) PB1 2| |39 PA1 (AI 1 / D25) INT2 (D 2) PB2 3| |38 PA2 (AI 2 / D26) PWM (D 3) PB3 4| |37 PA3 (AI 3 / D27) PWM/SS (D 4) PB4 5| |36 PA4 (AI 4 / D28) MOSI (D 5) PB5 6| |35 PA5 (AI 5 / D29) PWM/MISO (D 6) PB6 7| |34 PA6 (AI 6 / D30) PWM/SCK (D 7) PB7 8| |33 PA7 (AI 7 / D31) RST 9| |32 AREF VCC 10| |31 GND GND 11| |30 AVCC XTAL2 12| |29 PC7 (D 23) XTAL1 13| |28 PC6 (D 22) RX0 (D 8) PD0 14| |27 PC5 (D 21) TDI TX0 (D 9) PD1 15| |26 PC4 (D 20) TDO RX1/INT0 (D 10) PD2 16| |25 PC3 (D 19) TMS TX1/INT1 (D 11) PD3 17| |24 PC2 (D 18) TCK PWM (D 12) PD4 18| |23 PC1 (D 17) SDA PWM (D 13) PD5 19| |22 PC0 (D 16) SCL PWM (D 14) PD6 20| |21 PD7 (D 15) PWM +--------+ You appear to be out by one in each case. (SS is pin 5 not pin 4).
|
|
|
|
|
Logged
|
|
|
|
|
ca
Offline
Jr. Member
Karma: 0
Posts: 62
|
 |
« Reply #5 on: July 01, 2012, 12:58:03 am » |
Actually, i was referring to D4, D5, D6, D7  Anyone here has Ethernet working on Mighty 1284p ?
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 226
Posts: 14099
Lua rocks!
|
 |
« Reply #6 on: July 01, 2012, 01:17:34 am » |
Can you post the exact sketch you are trying? In code tags.
|
|
|
|
|
Logged
|
|
|
|
|
ca
Offline
Jr. Member
Karma: 0
Posts: 62
|
 |
« Reply #7 on: July 01, 2012, 01:26:29 am » |
All sketch from the Ethernet examples. Basic stuff. Arduino 1.0, 1.0.1 on either Windows7 or Mac OS X latest
I'm very confused at this point, i manage to find solution all by myself most of the time, must be a silly thing hanging there.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 226
Posts: 14099
Lua rocks!
|
 |
« Reply #8 on: July 01, 2012, 01:44:13 am » |
Looking at w5100.h: private: #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) inline static void initSS() { DDRB |= _BV(4); }; inline static void setSS() { PORTB &= ~_BV(4); }; inline static void resetSS() { PORTB |= _BV(4); }; #elif defined(__AVR_ATmega32U4__) inline static void initSS() { DDRB |= _BV(6); }; inline static void setSS() { PORTB &= ~_BV(6); }; inline static void resetSS() { PORTB |= _BV(6); }; #elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB162__) inline static void initSS() { DDRB |= _BV(0); }; inline static void setSS() { PORTB &= ~_BV(0); }; inline static void resetSS() { PORTB |= _BV(0); }; #else inline static void initSS() { DDRB |= _BV(2); }; inline static void setSS() { PORTB &= ~_BV(2); }; inline static void resetSS() { PORTB |= _BV(2); }; #endif
They don't seem to have a define for the Atmega1284 and the default would appear to be incorrect for you.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 269
Posts: 17035
Available for Design & Build services
|
 |
« Reply #9 on: July 01, 2012, 02:33:58 am » |
maniacbug's 1284 core files don't cover that? He's been pretty thorough with those.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 226
Posts: 14099
Lua rocks!
|
 |
« Reply #10 on: July 01, 2012, 03:41:00 am » |
I don't know. I just looked in w5100.h which is part of the Ethernet library.
|
|
|
|
|
Logged
|
|
|
|
|
ca
Offline
Jr. Member
Karma: 0
Posts: 62
|
 |
« Reply #11 on: July 01, 2012, 04:31:47 pm » |
Nothing else we can do ? 
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 226
Posts: 14099
Lua rocks!
|
 |
« Reply #12 on: July 01, 2012, 04:34:28 pm » |
Don't ignore reply #8.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 226
Posts: 14099
Lua rocks!
|
 |
« Reply #13 on: July 01, 2012, 04:38:48 pm » |
Try changing, in the code I posted: #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) inline static void initSS() { DDRB |= _BV(4); }; inline static void setSS() { PORTB &= ~_BV(4); }; inline static void resetSS() { PORTB |= _BV(4); };
to: #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284P__) inline static void initSS() { DDRB |= _BV(4); }; inline static void setSS() { PORTB &= ~_BV(4); }; inline static void resetSS() { PORTB |= _BV(4); };
I didn't look further than that. However it appears that the 1284P is not catered for in w5100.h. Maybe search for similar things in the Ethernet library.
|
|
|
|
|
Logged
|
|
|
|
|
ca
Offline
Jr. Member
Karma: 0
Posts: 62
|
 |
« Reply #14 on: July 01, 2012, 08:22:34 pm » |
Well i did change the lines inside w5100.h but it still doing the same. Feels like i don't know what i'm doing. :-)
|
|
|
|
|
Logged
|
|
|
|
|
|