Arduino due + SPI setClockDivider() function

Hello,

Firstly, I use an unofficial ethernet shield (with W5200 chip) with the new arduino due.

I modified the W5100 library for the W5200 chip and all the exemple sketches run very well.

The W5200 chip support a SPI clock at 80 Mhz and refering to the SAM3X8E datasheet (page 29), the arduino due 32bits ARM uC support a Max of 65 Mhz clock SPI.

Ok, now my question :

In the "void W5100Class::init(void)" function located in the "W5100.cpp"

When I set the SPI clock divider at the number 1 using "SPI.setClockDivider(1)" (to use the full 65 Mhz SPI clock speed), it is impossible to use the ethernet shield (not responding ??)

But if I comment my code (no call to SPI.setClockDivider at all) or if I set the clock divider at 2, all run well.

Why can I not set the clock divider at 1? And by default, when no call to SPI.setClockDivider() is called, at which speed is the SPI clock?

Any hint for me?

Thank you,

Fabien D.

I have succesfully used the Wiznet 5200 chip with a Due with a clock divider setting of 2, effectively running the SPI at 42MHz. The datasheet for the W5200 says it can go upto 80MHz on the SPI bus. Using 1 as a clock divider would be outside of the spec, giving a rate of 84MHz. I originally tried it at a slow speed and gradually built up to 42MHz.

At this speed I am able to have 8 different browser connections to the Due running as a simple web server all repeatedly requesting the sample page.

I see there was an alternative W5200 library for the Due using DMA on the SPI but with the faster clock speed I felt this wasnt needed for my application and performance has been great, compared to a 328 and W5100 based board.

Regards

Andy

duayfabi:
Hello,

Firstly, I use an unofficial ethernet shield (with W5200 chip) with the new arduino due.

I modified the W5100 library for the W5200 chip and all the exemple sketches run very well.

Witch one?