Skip to content

Commit bfd9e4e

Browse files
Merge pull request #154 from martinayotte/master
Fix issues with arduino_uip library and other minor changes on STM32F4
2 parents aff6ef0 + 49fa96c commit bfd9e4e

6 files changed

Lines changed: 23 additions & 22 deletions

File tree

STM32F4/libraries/arduino_uip/examples/TcpClient/TcpClient.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ void setup() {
3030
Ethernet.begin(mac);
3131

3232
Serial.print("localIP: ");
33-
Serial.println(Ethernet.localIP());
33+
Serial.println(Ethernet.localIP().toString());
3434
Serial.print("subnetMask: ");
35-
Serial.println(Ethernet.subnetMask());
35+
Serial.println(Ethernet.subnetMask().toString());
3636
Serial.print("gatewayIP: ");
37-
Serial.println(Ethernet.gatewayIP());
37+
Serial.println(Ethernet.gatewayIP().toString());
3838
Serial.print("dnsServerIP: ");
39-
Serial.println(Ethernet.dnsServerIP());
39+
Serial.println(Ethernet.dnsServerIP().toString());
4040

4141
next = 0;
4242
}

STM32F4/libraries/arduino_uip/library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ email=Norbert Truchsess <norbert.truchsess@t-online.de>
44
sentence=Ethernet library for ENC28J60
55
paragraph=implements the same API as stock Ethernet-lib. Just replace the include of Ethernet.h with UIPEthernet.h
66
url=https://github.com/ntruchsess/arduino_uip
7-
architectures=STM32F1
7+
architectures=STM32F4
88
version=1.04
99
dependencies=
1010
core-dependencies=arduino (>=1.5.0)

STM32F4/libraries/arduino_uip/utility/Enc28J60Network.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ static byte selectPin;
5757

5858
void Enc28J60Network::init(uint8_t* macaddr)
5959
{
60+
uint32 timeout = 0;
6061
MemoryPool::init(); // 1 byte in between RX_STOP_INIT and pool to allow prepending of controlbyte
6162
// initialize I/O
6263
// ss as output:
@@ -100,8 +101,12 @@ void Enc28J60Network::init(uint8_t* macaddr)
100101
#ifdef ENC28J60DEBUG
101102
Serial.println("ENC28J60::initialize / before readOp(ENC28J60_READ_CTRL_REG, ESTAT)");
102103
#endif
103-
while (!readOp(ENC28J60_READ_CTRL_REG, ESTAT) & ESTAT_CLKRDY)
104-
;
104+
while (!readOp(ENC28J60_READ_CTRL_REG, ESTAT) & ESTAT_CLKRDY) {
105+
if (++timeout > 100000) {
106+
Serial.println("ENC28J60::initialize TIMEOUT !!!\r\n");
107+
return;
108+
}
109+
}
105110
#ifdef ENC28J60DEBUG
106111
Serial.println("ENC28J60::initialize / after readOp(ENC28J60_READ_CTRL_REG, ESTAT)");
107112
#endif

STM32F4/libraries/arduino_uip/utility/Enc28J60Network.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,12 @@
2828
#include <SPI.h>
2929
#include "mempool.h"
3030

31-
//#define ENC28J60_CONTROL_CS SS
32-
//#define SPI_MOSI MOSI
33-
//#define SPI_MISO MISO
34-
//#define SPI_SCK SCK
35-
//#define SPI_SS SS
3631

32+
#ifdef ARDUINO_STM32F4_NETDUINO2PLUS
3733
#define ENC28J60_CONTROL_CS PC8
38-
//#define SPI_MOSI PA7
39-
//#define SPI_MISO PA6
40-
//#define SPI_SCK PA5
41-
//#define SPI_SS PA8
34+
#else
35+
#define ENC28J60_CONTROL_CS SPI.nssPin()
36+
#endif
4237

4338
#define UIP_RECEIVEBUFFERHANDLE 0xff
4439

STM32F4/platform.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ compiler.define=-DARDUINO=
3232
# this can be overriden in boards.txt
3333
build.cpu_flags=
3434
build.hs_flag=
35-
build.common_flags=
35+
build.common_flags=-mthumb -D__STM32F4__
3636
build.extra_flags= {build.cpu_flags} {build.hs_flag} {build.common_flags}
3737

3838
# These can be overridden in platform.local.txt
@@ -125,10 +125,11 @@ tools.serial_upload.upload.pattern="{path}/{cmd}" {serial.port.file} {upload.alt
125125

126126
# STLINK/V2
127127

128-
tools.stlink.cmd=stlink
128+
tools.stlink.cmd=stlink_upload
129129
tools.stlink.cmd.windows=stlink_upload.bat
130-
#tools.stlink.cmd.linux=
130+
#tools.stlink.cmd.linux=stlink_upload
131131
tools.stlink.path={runtime.hardware.path}/tools/win
132+
tools.stlink.path.linux={runtime.hardware.path}/tools/linux/
132133
tools.stlink.upload.params.verbose=-d
133134
tools.stlink.upload.params.quiet=
134135
tools.stlink.upload.pattern="{path}/{cmd}" {serial.port.file} {upload.altID} {upload.usbID} "{build.path}/{build.project_name}.bin"

STM32F4/variants/discovery_f407/ld/jtag.ld

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
2-
* aeroquad32 (STM32F103VET6, high density) linker script for
2+
* STM32F4xx high density linker script for
33
* JTAG (bare metal, no bootloader) builds.
44
*/
55

66
MEMORY
77
{
8-
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
9-
rom (rx) : ORIGIN = 0x08000000, LENGTH = 512K
8+
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K
9+
rom (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
1010
}
1111

1212
/* GROUP(libcs3_stm32_high_density.a) */

0 commit comments

Comments
 (0)