2020-12-01 09:47 AM
Hello, I recently migrated from old 5.4.0 CubeMX to the STM32CubeMX version 6.0.1. I did not have this binding issue with Firmware Package STM32Cube FW_F7 V1.15.0 in CubeIDE. Now that I am using STM32Cube FW_F7 V1.16.0 the error occurs in the below block of code on the line: if (bind(socket_fd, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)) == -1):
void UdpStreamTask() {
int socket_fd;
struct sockaddr_in sa, ra;
int sent_data;
struct udp_pcb *rxPcbPtr;
app_assert(0 != m_streamPtr);
// RX setup - create a new UDP control block
rxPcbPtr = udp_new();
app_assert(NULL != rxPcbPtr);
// set a receive callback for the rxPcbPtr
udp_recv(rxPcbPtr, udpRxCallback, this);
// set the remote port
rxPcbPtr->remote_port = m_remoteUdpPort;
// bind using the rxPcbPtr to the local port port
if (udp_bind(rxPcbPtr, IP4_ADDR_ANY, m_localUdpPort) != ERR_OK)
{
app_assert(false);
}
// TX setup - create the socket
socket_fd = socket(PF_INET, SOCK_DGRAM, 0);
app_assert(socket_fd >= 0);
// set up the local endpoint
memset(&sa, 0, sizeof(struct sockaddr_in));
sa.sin_family = AF_INET;
sa.sin_addr.s_addr = m_localIP; ///> 192.168.45.180
sa.sin_port = htons(m_localUdpPort);
// bind the socket to the specified IP address and port --> BINDING ERROR HAPPENS HERE!! Error is from netconn_bind and error is ERR_USE = -8,
if (bind(socket_fd, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)) == -1)
{
app_assert(false);
}
// set up the remote endpoint
memset(&ra, 0, sizeof(struct sockaddr_in));
ra.sin_family = AF_INET;
ra.sin_addr.s_addr = m_remoteIP; ///> 192.168.45.179
ra.sin_port = htons(m_remoteUdpPort);
for (;;;)
{
// handle RX and send data to the remote endpoint
.....
////////////////
Specifically, this error occurs within:
if (bind(socket_fd, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)) == -1)
{
app_assert(false);
}
After the call to bind(), netconn_bind() is called and results in the error ERR_USE = -8,
This only occurs in the latest firmware package, so I am thinking perhaps there is a setting I am missing?
many thanks for any help.
2020-12-02 12:38 AM
Dear @KSulli ,
Thank you for your feedback,
Could you please share your .ioc file.
Kind regards,
Houssem
2020-12-02 01:27 AM
2020-12-02 11:59 AM
2021-01-08 02:28 AM
Hello @Houssem CHAABANI
Are there any updates on this issue?
Many thanks,