Re: Setting MAC address on STM32.

2020-08-02 Thread Gregory Nutt
Also as Mr. Greg explained the application needs to setup the MAC address when the connection was lost and recovered. I didn't mean to imply that.  It simply has be bring the network down and then bring it back up again when the link is again detected by the PHY. The MAC address is just a

Re: Setting MAC address on STM32.

2020-08-02 Thread Alan Carvalho de Assis
Hi Fotis, On 8/2/20, Fotis Panagiotopoulos wrote: >> Where do you initialize the IP address? You should use the same socket >> descriptor to call the ioctl to set the MAC address at that location > > I am using the NuttX apps package for the moment, and specifically nsh. So > I guess this code

Re: Setting MAC address on STM32.

2020-08-02 Thread Gregory Nutt
On the other hand, the MAC address is a hard-wired address, accessed in a hardware specific way. In my opinion the application shouldn't mess with it and it is best to be set once during the hardware initialization. The code follows the same model and uses the same IOCTL commands as does

Re: Setting MAC address on STM32.

2020-08-02 Thread Fotis Panagiotopoulos
> Where do you initialize the IP address? You should use the same socket > descriptor to call the ioctl to set the MAC address at that location I am using the NuttX apps package for the moment, and specifically nsh. So I guess this code handles everything for me. But still, I believe that the

Re: Setting MAC address on STM32.

2020-08-02 Thread Gregory Nutt
Yes I saw this, but it does not seem a very good option to me. It requires you to set up the hardware in the application, and does not seem very efficient. Where do you initialize the IP address?  You should use the same socket descriptor to call the ioctl to set the MAC address at that

Re: Setting MAC address on STM32.

2020-08-02 Thread Fotis Panagiotopoulos
> You can always set the MAC address in your application at any time after > booting using > https://github.com/apache/incubator-nuttx-apps/blob/master/netutils/netlib/netlib_setmacaddr.c > or similar

Re: Setting MAC address on STM32.

2020-08-02 Thread Gregory Nutt
Thank you both. I followed the example of same70-xplained, and essentially I do the exact same thing. However, as I get it, the final step would be to call stm32_macaddress() to set the address to the MAC. This function takes as an argument a struct stm32_ethmac_s which is private to the

Re: Setting MAC address on STM32.

2020-08-02 Thread Fotis Panagiotopoulos
Thank you both. I followed the example of same70-xplained, and essentially I do the exact same thing. However, as I get it, the final step would be to call stm32_macaddress() to set the address to the MAC. This function takes as an argument a struct stm32_ethmac_s which is private to the

Re: Setting MAC address on STM32.

2020-08-02 Thread Alan Carvalho de Assis
Hi Fotis, Please take a look at arm/samv7/same70-xplained/src/sam_ethernet.c It does exactly what you are planing to do. BR, Alan On 8/2/20, Fotis Panagiotopoulos wrote: > Hi, > > I am using an STM32F427 MCU on a project that I am porting to NuttX. > For the moment everything seems to be

Re: Setting MAC address on STM32.

2020-08-02 Thread Jukka Laitinen
Hi, I have used in init scripts:     ifconfig eth0 hw     ifup eth0 One suitable place could be in rc.board_defaults, you just need to fetch the mac address from the eeprom first with some other program. Another option surely is to bring it up in board's board_app_initialize or such...

Setting MAC address on STM32.

2020-08-02 Thread Fotis Panagiotopoulos
Hi, I am using an STM32F427 MCU on a project that I am porting to NuttX. For the moment everything seems to be working, apart from the Ethernet MAC. I really can't find the correct way to set the MAC address to the Ethernet driver. My hardware uses an I2C EEPROM to store the MAC address. I will

Re: Integrating Nuttx to a firmware project.

2020-08-02 Thread Fotis Panagiotopoulos
Thanks everyone for the help. I managed to have everything set up to my liking. As a reference for others trying to manage multiple builds, here is what I did: I created scripts for every build, using the following format: # Example contents of DEBUG.sh kconfig-tweak --enable