9 years, 9 months ago.

Nucleo F401RE

Hello! I'm working on my course project using Nucleo F401RE and ENC28J60 module, so I'm trying to compile your program as example.

There is a code:

#if defined(TARGET_LPC1768)
UIPEthernetClass UIPEthernet(p11, p12, p13, p8);          // mosi, miso, sck, cs
#elif defined(TARGET_LPC1114)
UIPEthernetClass UIPEthernet(dp2, dp1, dp6, dp25);      // mosi, miso, sck, cs
#elif defined(TARGET_LPC11U68)
UIPEthernetClass UIPEthernet(P0_9, P0_8, P1_29, P0_2);  // mosi, miso, sck, cs
#elif defined (TARGET_NUCLEO_F103RB)
UIPEthernetClass UIPEthernet(PB_5, PB_4, PB_3, PB_6);   // mosi, miso, sck, cs
#endif

I don't know how to add code below correctly to create an UIPEthernetClass object (pins are correct).

UIPEthernetClass UIPEthernet(D11, D12, D13, D10);   // mosi, miso, sck, cs

Could you help me to modify it for Nucleo F401RE?

Question relating to:

HTTP Server serving a simple webpage which enables to remotely turn a digital output on/off. Compile, download, run and type 'IP_address/secret/' (don't forget the last '/') into your web browser … ENC28J60, ethernet, HTTP server, uIP, UIPEthernet, webserver

2 Answers

9 years, 9 months ago.

This is code fragment (tested) for 401RE and Arduino ENC28J60 shield:

#if defined(TARGET_LPC1768)
UIPEthernetClass UIPEthernet(p11, p12, p13, p8);        // mosi, miso, sck, cs
#elif defined(TARGET_LPC1114)
UIPEthernetClass UIPEthernet(dp2, dp1, dp6, dp25);      // mosi, miso, sck, cs
#elif defined(TARGET_LPC11U68)
UIPEthernetClass UIPEthernet(P0_9, P0_8, P1_29, P0_2);  // mosi, miso, sck, cs
#elif defined (TARGET_NUCLEO_F103RB)
UIPEthernetClass UIPEthernet(PB_5, PB_4, PB_3, PB_6);   // mosi, miso, sck, cs
#elif defined (TARGET_NUCLEO_F401RE)
UIPEthernetClass UIPEthernet(PA_7, PA_6, PA_5, PB_6);   // mosi, miso, sck, cs
#endif

But beware of the important detail. In this example program (WebSwitch) is collision on pin PA_5 (spi sck and Led1) if you use arduino pins 10,11,12,13. In this case you must redefine led (variable sw) to any free pin and connect this pin to external led:

DigitalOut       sw(LED1);

If you use the module with the wires (not shield), it is better to use alternative spi connection as in line for Nucleo 103RB.

Thanks for your answer. I use ENC28J60 with the wires (not Arduino Shield), so I connect it to Nucleo 401RE as it written below:

  • (401RE) - (ENC28J60)
  • MOSI/D11 - MOSI
  • MISO/D12 - MISO
  • SCK/D13 - SCK
  • CS/D10 - CS
  • D5 - RST
  • 3V3 - 3.3
  • GND - GND

But I still doesn't work. The program compiles, but I can't open the web-page 192.168.1.181\secret and switch the LED.

posted by Kamil Yagafarov 28 Jan 2015

Yes, there is some unexplained problem with this program and the 401RE.

I checked the operation of the library and Nucleo_401RE connection with ENC28J60 shield, using the example HTTPServer_Echo_ENC28J60. And it worked correctly.

Then I checked WebSwitch_ENC28J60 and despite redefine Led output (because I use a shield using the same pins as you), the program on Nucleo crashes and stops transmission of the SPI when address was selected in the browser. Same symptoms as your test.

But yet tried Nucleo_L152RE on the same code and shield. And surprisingly it works and does not suspend, but not quite right. If I choose the address "secret" browser gives me a warning about the many redirects. In other cases gives reasonable answers.

At the moment I do not know what happens so unstable that this program works.

posted by Nothing Special 28 Jan 2015
9 years, 9 months ago.

Hi Kamil,

Try to connect the ENC28J60 board to the ST Nucleo F401RE as follows:

  • MOSI - MOSI/D4
  • MISO - MISO/D5
  • SCK - SCK/D3
  • CS - CS/D10
  • 3.3 - 3V3
  • GND - GND

Do not connect the RST pin. It is not used. Compile and download the binary from the mbed site into your board (the above SPI pin assignment for ST Nucleo F401RE is already implemented into the current revision of Web Switch). Make sure that DHCP is disabled on your network modem/router. This is important because the Web Switch server is using a static IP address 192.168.1.181. If it happens that you are already using static IP addresses but the address 192.168.1.181 is already assigned to another device then use different IP address. For example 192.168.1.182 and modify the source code before compiling as follows:

const IPAddress MY_IP(192,168,1,182);

When typing the IP address and password into your browser, please use slash ("/") instead of back slash ("\") as follows:

192.168.1.181/secret

Unfortunately the ST Nucleo F401RE board is not available for me so I'm not able to test it but I hope this helped.

Cheers and good luck.

Zoltan

Just want to comment that I am able to get F401RE with ENC28J60 module working with the above pins configuration.

posted by S. Ken San 02 Mar 2015