2021-10-29 02:20 AM
Hello All,
I am trying to create a simple project for transmitting some UDP packet but it is not working.
I have used STM32cube to generate the project with below configuration:
Change Timebase to TIM6
Setup the MPU and enable D and I Cache
Selected below middleware
Changed the linker script
.tcp_sec (NOLOAD) : {
. = ABSOLUTE(0x30040000);
*(.RxDecripSection)
. = ABSOLUTE(0x30040060);
*(.TxDecripSection)
} >RAM_D2 AT> FLASH
.nx_data 0x30040200 (NOLOAD):
{
*(.NetXPoolSection)
} >RAM_D2 AT >FLASH
Added below code to app_netx_duo.c
/* Create the main NX_IP instance */
IpAddress = IP_ADDRESS(10, 10, 1, 56);
ret = nx_ip_create(&IpInstance, "Main Ip instance", IpAddress, 0xFFFFFF00UL, &AppPool, nx_stm32_eth_driver,
pointer, 2 * DEFAULT_MEMORY_SIZE, DEFAULT_PRIORITY);
if (ret != NX_SUCCESS)
{
return NX_NOT_ENABLED;
}
/* Allocate the memory for ARP */
if (tx_byte_allocate(byte_pool, (VOID **) &pointer, DEFAULT_MEMORY_SIZE, TX_NO_WAIT) != TX_SUCCESS)
{
return TX_POOL_ERROR;
}
/* Enable the ARP protocol and provide the ARP cache size for the IP instance */
ret = nx_arp_enable(&IpInstance, (VOID *)pointer, DEFAULT_MEMORY_SIZE);
if (ret != NX_SUCCESS)
{
return NX_NOT_ENABLED;
}
/* Enable the ICMP */
ret = nx_icmp_enable(&IpInstance);
if (ret != NX_SUCCESS)
{
return NX_NOT_ENABLED;
}
//#ifdef NEVER
/* Enable the UDP protocol required for DHCP communication */
ret = nx_udp_enable(&IpInstance);
/* Allocate the memory for main thread */
if (tx_byte_allocate(byte_pool, (VOID **) &pointer,2 * DEFAULT_MEMORY_SIZE, TX_NO_WAIT) != TX_SUCCESS)
{
return TX_POOL_ERROR;
}
/* Allocate the memory for UDP client thread */
if (tx_byte_allocate(byte_pool, (VOID **) &pointer,2 * DEFAULT_MEMORY_SIZE, TX_NO_WAIT) != TX_SUCCESS)
{
return TX_POOL_ERROR;
}
/* create the UDP client thread */
ret = tx_thread_create(&AppUDPThread, "App UDP Thread", App_UDP_Thread_Entry, 0, pointer, 2 * DEFAULT_MEMORY_SIZE,
DEFAULT_PRIORITY, DEFAULT_PRIORITY, TX_NO_TIME_SLICE, TX_AUTO_START);
if (ret != TX_SUCCESS)
{
return NX_NOT_ENABLED;
}
I have created a static IP address rather than dynamic IP address. Also changed my PC IP Address similarly.
If I try using freertos and LWIP then it all works suggesting that link to board and PC are fine.
Can you please suggest if I am missing anything.
Kind Regards
2021-12-23 06:09 AM
Hello @Community member
Could you, please, provide the code for the task that handles the UDP communication?
Thanks in advance.
BeST Regards,
Walid