Julien.bresciani
New member
Hi Paul,
First I thank you immensely for making such a nice product, this is my first steps in microcontrollers /embedded electronics, your product is so tiny and can become a real use in everyday life.
I m working with a colleague on a wireless project, and try to use the RFM 22 from hoperf in combination with the arduino ethernet shield.
Im just trying to make these work together at this time.
first point :
While playing with the ethernet shield + teensy inside arduino IDE, I have tried to relocate the SPI SS pin of the arduino shield.
Unfortunately, arduino developpers made a lot of stuff very static and never thougt material possibilities will evolve very quickly, so the ss pin is defined statically somewhere in the libraries.
The caveat in the arduino IDE : it seems to be impossible to simply override a static definition #DEFINE made in a library you are including just by putting a #DEFINE inside your sketch e.g :
inside W5100.cpp :
#define W5200_SS_PIN 10
If I want to change from my sketch this definition, I found no else mean than editing directly the W5100.cpp and changing the #define W5200_SS_PIN wich may seem an easy job, but when you begin to have multiple peripherals, going inside each .h or .cpp file may become difficult.
a call to a very General file like Global_definitions.h where you could put all your #DEFINES overrides could be a good idea inside the arduino IDE, this .h file should just be called inside each already existing arduino library.
Nevertheless, this point is just to have your mind about it, since i think you may suffer from the lack of flexibility of the arduino libs (interrupts, ans SPI specillay.
second point (and more relating to the teensy):
While poking around this library, I noticed the PIN 10 was hardcoded inside W5100.h (libraries/Ethernet/utility)
So i did this small change to the .h :
replaced the static pin number by the defined variable W5200_SS_PIN
moved the #DEFINE W5200_SS_PIN from w5100.cpp to w5100.h for this variable to be set and not having compilation errors.
so inside w5100.h i got :
at the top of the file :
line 323 :
and got rid of the W5200_SS_PIN 6 inside the W5100.cpp file (line 29).
did the test with teensy 3.0 + arduino ethernet shield REV 3, the webserver example runs successfully.
as my experience is very low in programmation and microcontrollers world, I hope my analysis and correction is correct and is improving a bit the code.
hope you can integrate this in the next teensyduino or push it directly through arduino IDE.
Regards.
First I thank you immensely for making such a nice product, this is my first steps in microcontrollers /embedded electronics, your product is so tiny and can become a real use in everyday life.
I m working with a colleague on a wireless project, and try to use the RFM 22 from hoperf in combination with the arduino ethernet shield.
Im just trying to make these work together at this time.
first point :
While playing with the ethernet shield + teensy inside arduino IDE, I have tried to relocate the SPI SS pin of the arduino shield.
Unfortunately, arduino developpers made a lot of stuff very static and never thougt material possibilities will evolve very quickly, so the ss pin is defined statically somewhere in the libraries.
The caveat in the arduino IDE : it seems to be impossible to simply override a static definition #DEFINE made in a library you are including just by putting a #DEFINE inside your sketch e.g :
inside W5100.cpp :
#define W5200_SS_PIN 10
If I want to change from my sketch this definition, I found no else mean than editing directly the W5100.cpp and changing the #define W5200_SS_PIN wich may seem an easy job, but when you begin to have multiple peripherals, going inside each .h or .cpp file may become difficult.
a call to a very General file like Global_definitions.h where you could put all your #DEFINES overrides could be a good idea inside the arduino IDE, this .h file should just be called inside each already existing arduino library.
Nevertheless, this point is just to have your mind about it, since i think you may suffer from the lack of flexibility of the arduino libs (interrupts, ans SPI specillay.
second point (and more relating to the teensy):
While poking around this library, I noticed the PIN 10 was hardcoded inside W5100.h (libraries/Ethernet/utility)
So i did this small change to the .h :
replaced the static pin number by the defined variable W5200_SS_PIN
moved the #DEFINE W5200_SS_PIN from w5100.cpp to w5100.h for this variable to be set and not having compilation errors.
so inside w5100.h i got :
at the top of the file :
Code:
#ifndef W5100_H_INCLUDED
#define W5100_H_INCLUDED
#include <avr/pgmspace.h>
#include <SPI.h>
#define MAX_SOCK_NUM 4
#define W5200_SS_PIN 6
line 323 :
Code:
/*#elif defined(__MK20DX128__)
// ugly static pin definition.
inline static void initSS() { pinMode(10, OUTPUT); };
inline static void setSS() { digitalWriteFast(10, LOW); };
inline static void resetSS() { digitalWriteFast(10, HIGH); };
*/
#elif defined(__MK20DX128__)
// try this instead
inline static void initSS() { pinMode(W5200_SS_PIN, OUTPUT); };
inline static void setSS() { digitalWriteFast(W5200_SS_PIN, LOW); };
inline static void resetSS() { digitalWriteFast(W5200_SS_PIN, HIGH); };
and got rid of the W5200_SS_PIN 6 inside the W5100.cpp file (line 29).
did the test with teensy 3.0 + arduino ethernet shield REV 3, the webserver example runs successfully.
as my experience is very low in programmation and microcontrollers world, I hope my analysis and correction is correct and is improving a bit the code.
hope you can integrate this in the next teensyduino or push it directly through arduino IDE.
Regards.