AnsweredAssumed Answered

stmCubeMx for STM32F7xx cpu ethernet function low_level_init not correct i think

Question asked by Jos Poelmans on Mar 8, 2017
Latest reply on Mar 10, 2017 by Jos Poelmans

static void low_level_init(struct netif *netif)

{

uint32_t regvalue = 0;

HAL_StatusTypeDef hal_eth_init_status;

 

/* Init ETH */

 

uint8_t MACAddr[6] ;

heth.Instance = ETH;

heth.Init.AutoNegotiation = ETH_AUTONEGOTIATION_ENABLE;

heth.Init.PhyAddress = LAN8742A_PHY_ADDRESS;

MACAddr[0] = 0x00;

MACAddr[1] = 0x80;

MACAddr[2] = 0xE1;

MACAddr[3] = 0x00;

MACAddr[4] = 0x00;

MACAddr[5] = 0x00;

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;

 

heth.Init.MACAddr is a pointer to the MACAddr. but when i leave this funtion the pointer is not pointing to a defined

memory space. It is later on in the program not possible to get the MacAddr info form

heth.Init.MACAddr.  The pointer must point to a MACAddr that is available all the time the program is running.

Outcomes