2021-04-13 02:38 AM
Good day!
I have some problems with UDP packets transmission. Seems that UDP packets sometimes not sent
Board was developed on STM32F407VET6 using LAN8742A driver.
UDP packets with size 1200 bytes are sending using timer 10 in 200 ms interval.
void HAL_TIM_PeriodElapsedCallback (TIM_HandleTypeDef *htim)
{
if (htim->Instance == TIM10)
{
static uint8_t flag = 0;
uint16_t sz = 1200;
uint8_t Data[sz];
if (flag)
memset(Data, 0, sz);
else
memset(Data, 127, sz);
flag = ~flag;
struct pbuf *p;
ip_addr_t addrPC;
addrPC.addr = 0x3703000A;
p = pbuf_alloc(PBUF_TRANSPORT, sz, PBUF_RAM); // Allocate packet buffer
memcpy (p->payload, (void*) Data, sz);
err_t volatile err = udp_sendto(voiceSocket, p, &addrPC, 11000);
pbuf_free(p); // De-allocate packet buffer
}
}
With the help of some analizing tools I found that ETH_TX_EN signal disappears randomly.
Ethernrt controller settings are:
/* Init ETH */
uint8_t MACAddr[6] ;
heth.Instance = ETH;
heth.Init.AutoNegotiation = ETH_AUTONEGOTIATION_ENABLE;
heth.Init.Speed = ETH_SPEED_100M;
heth.Init.DuplexMode = ETH_MODE_FULLDUPLEX;
heth.Init.PhyAddress = LAN8742A_PHY_ADDRESS;
MACAddr[0] = 0x00;
MACAddr[1] = 0x80;
MACAddr[2] = 0xE1;
MACAddr[3] = 0x01;
MACAddr[4] = 0x23;
MACAddr[5] = 0x45;
heth.Init.MACAddr = &MACAddr[0];
heth.Init.RxMode = ETH_RXPOLLING_MODE;
heth.Init.ChecksumMode = ETH_CHECKSUM_BY_SOFTWARE;
heth.Init.MediaInterface = ETH_MEDIA_INTERFACE_RMII;
Can anyone got a similar problem?
2021-06-30 01:59 AM
Hello @Sergey Titov ,
Welcome to our ST Community :)
I recommend you to take a look at the example provided in our F4 firmware package ( Path : Projects\STM324x9I_EVAL\Applications\LwIP\LwIP_UDP_Echo_Client )
Use it as inspiration.
BeST Regards,
Walid