AnsweredAssumed Answered

CubeMX : new USER CODE section needed in ethernetif.c

Question asked by Gori.Mario on Oct 6, 2015
Latest reply on May 23, 2017 by kerr.matthew
In source code generated by CubeMX would be useful to add a new USER CODE section in ethernetif.c in order to allow the user to change the MAC address.
For example:
.....
 MACAddr[0] = 0x00;
  MACAddr[1] = 0x80;
  MACAddr[2] = 0xE1;
  MACAddr[3] = 0x12;
  MACAddr[4] = 0x34;
  MACAddr[5] = 0x56;
  heth.Init.MACAddr = &MACAddr[0];
  heth.Init.RxMode = ETH_RXINTERRUPT_MODE;
  heth.Init.ChecksumMode = ETH_CHECKSUM_BY_HARDWARE;
  heth.Init.MediaInterface = ETH_MEDIA_INTERFACE_RMII;

  /* USER CODE BEGIN x */

  heth.Init.MACAddr = &MyMacAddr[0];

  /* USER CODE END x */

  hal_eth_init_status = HAL_ETH_Init(&heth);
.....

Regards
Mario

Outcomes