Using a W5100 with nucleo-f401...

Hello,

I would like to run the gnrc_minimal example on my nucleo-f401 board. The board does not have ethernet BUT I use the arduino W5100 shield with it (https://www.arduino.cc/en/Main/ArduinoEthernetShieldV1). Hence

cd examples/gnrc_minimal BOARD=nucleo-f401 make clean all flash term

But I see only the "RIOT network stack example application" message and no "My address is ...".

From compilation output it seems to be that w5100 is NOT compiled at

all. As I has expected, there is still something missing.

Here are my questions:

1. I have to tweak the build to include the w5100 compilation. How to do this?

2. I have to use (and initialize) the SPI1 of the nucleo-f401 board. How to do this?

3. Finally, I have to configure that the the SPI1 of nucleo-f401 it the 'underlying' SPI of w5100 and that the w5100 should be used for networking. How to do this?

Kind regards,

aanno

Hi,

Welcome and thanks for your interest in RIOT !

----- Mail original -----

I would like to run the gnrc_minimal example on my nucleo-f401 board. The board does not have ethernet BUT I use the arduino W5100 shield with it (https://www.arduino.cc/en/Main/ArduinoEthernetShieldV1). Hence

cd examples/gnrc_minimal BOARD=nucleo-f401 make clean all flash term

You are building your application the right way.

But I see only the "RIOT network stack example application" message and no "My address is ...".

From compilation output it seems to be that w5100 is NOT compiled at all. As I has expected, there is still something missing.

Here are my questions:

1. I have to tweak the build to include the w5100 compilation. How to do this?

Yes, you have to import the module corresponding to the W5100 driver. Simply add USE_MODULE += w5100

2. I have to use (and initialize) the SPI1 of the nucleo-f401 board. How to do this?

The initialization is done automatically, since the 'minimal' example uses the 'auto_init' module.

3. Finally, I have to configure that the the SPI1 of nucleo-f401 it the 'underlying' SPI of w5100 and that the w5100 should be used for networking. How to do this?

You can copy the file drivers/w5100/include/w5100_params.h in examples/minimal and edit the parameters to your needs. Otherwise you can directly edit the file in the drivers directory but this is not considered as good practice.

We know that this part of RIOT is not very well documented. An issue exists to keep track of this weakness [1]

Regards,

Alex

[1] Better document how to use devices that support auto_init · Issue #7001 · RIOT-OS/RIOT · GitHub

Adding a missing information in my previous reply about adding the module (sorry):

Simply add USE_MODULE += w5100 in the application Makefile: examples/minimal/Makefile.

Alex

----- Mail original -----

Hi,

@Alex: Thank you very much for your support!

I've moved my code to

- the code is a modified version of RIOT/examples/gnrc_networking. However, it is still not working, i.e. when I try

make flash

The minicom terminal tells me:

[w5100] error: no SPI connection

Here are the points are not sure about:

1. I haven't fully understood how to copy drivers/w5100/include/w5100_params.h and use that. Instead I have modified the file in-place and added the following

#define W5100_PARAM_SPI (SPI_DEV(0)) // ??? #define W5100_PARAM_SPI_CLK (SPI_CLK_5MHZ) #define W5100_PARAM_CS (GPIO_PIN(PORT_B, 6)) // PB_6 #define W5100_PARAM_EVT (GPIO_PIN(PORT_A, 10)) // PA_10

2. I'm not sure if it is my (i.e. main.c) job to initialize SPI and/or GPIO and/or W5100_PARAM_CS. I've written the init() method in main.c for this purpose. But maybe it is 'too late' then?!?

Kind regards,

aanno

Hi,

Have a look at the board configuration file and especially this line [1]. You are setting CS pin to PB6 and the board uses PA4. Otherwise your code looks good to me.

Maybe Hauke Petersen could help as we wrote the W5100 driver and know Nucleo a bit.

Alex

[1] https://github.com/RIOT-OS/RIOT/blob/master/boards/nucleo-f401/include/periph_conf.h#L173

----- Mail original -----

Hi,

actually, I have never tried my w5100 shield on a nucleo board... I don't know how many versions of this exist, but my shield uses the dedicated ICSP header (not present on nucleo bords) for the SPI pins - so I actually cant tell if it is possible to run this shield on nucleo boards... Always remember, just because something tells us it is Arduino 'compatible' or 'like', it does not mean it will work :slight_smile:

Cheers, Hauke