-
Notifications
You must be signed in to change notification settings - Fork 1k
Ethernet and SPI #652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @palmerr23, Arduino_Core_STM32/variants/BLACK_F407XX/variant.h Lines 287 to 291 in 2280453
|
Thanks Frederic, Those tally with what I'm reading at runtime. I'll keep digging into the code to see why these aren't translating into the right defaults in SPI.h Richard |
As far as I know it was ok. Maybe a misalignment appears when introduced other black F4 variants. |
Frederic, Basic SPI is working fine on its own, without Ethernet. I can't get the SPI library to control the SSEL line directly, but I'll explore whether that's my misconfiguration or the code, later. The board mappings look fine - at least the SPI definitions haven't slipped as other boards were added. After not playing round in the core of Arduino-land for a while, I got confused by the two ways of referring to pins, and forgot about the digitalPinToPinName() mapping. This led me astray while looking for problems. I'll delve into the Ethernet libraries next to see how they are calling the SPI. Richard |
Hi Richard, Edit: |
Great thanks, Frederic. I've now got it basically working and the max UDP rate I can get is 1000 pps (60 byte packets), which is a bit poor. No where near even the low end of Paul S's benchmarks (80 kb/Sec on a Uno WIZ5500). I get dropped packets if I don't have a substantial wait on the send side between packets (500+ uS). I'm going to play with the SPI speeds next to see if this is part of the issue. I've been using a WIZ5100 board so far, and might try a pair of 5500s to see if they are any better. Unless you care to track me optimizing Ethernet on STM32, we could close this issue now. Richard |
You can set CS pin to use with Paul's library. |
Thanks uzi18. |
Frederic,
I'm trying to get a WIZ5100 module working on a Black 407 VET6 (Core V1.6.1). I'm quite familiar with the hardware and SPI/Ethernet.
W5100.cpp in the Arduino core Ethernet libraries calls SPI.Begin() - with no parameters. Perfectly fine, except that the default MISO/MOSI pins are 20/21, which map to (in variant.cpp)
#define PA12 20 // USB_DP
#define PA11 21 // USB_DM
To find which pins are actually being used, I added the following code to your SPI.cpp after setSSEL(...) (equivalent to Paul Stoffregen's extra code in the Teensy version).
//rp added for debug
uint32_t mosiPin(void)
{
return _spi.pin_mosi;
};
uint32_t misoPin(void)
{
return _spi.pin_miso;
};
uint32_t sclkPin(void)
{
return _spi.pin_sclk;
};
uint32_t sselPin(void)
{
return _spi.pin_ssel;
};
at runtime
mosiPin() returns 21
misoPin() returns 20
What I'm having trouble tracing is how the defaults for these pins are set in the STM32 core. The traditional defaults at runtime are:
PIN_SPI_MOSI and MOSI = 6
PIN_SPI_MISO and MISO = 74
... so these aren't the values being used
Can you provide me with a clue of where the SPI defaults are set for the STM32 variants, so that they can be changed to the most sensible values for this board - which would be the standard pins on the NRF24L01 header:
SPI1-MISO PB4
SPI1-MOSI PB5
SPI1-SCK = PB3
Richard
The text was updated successfully, but these errors were encountered: