FreeRTOS_AddNetworkInterface(xLoopbackInterface);
FreeRTOS_IPStart();
xTaskCreate(prvEchoClientRxTask, "rx", 300, NULL, 1U, &RXTask);
xTaskCreate(vTCPSend, "tx", 300, NULL, 2U, &TXTask);
vTaskStartScheduler();
for(;;){
puts("shouldnt be here");
}
return;
}
~~~
I am unsure whether or not the way I have initialised the interface is right or not – I am using the FreeRTOS +TCP unofficial release with the loopback NetworkInterface.c
Stepping through, I meet my first problem in FreeRTOS_connect, when the prvConnectStart( pxSocket, pxAddress) is called the socket has not yet been bound, so goes into the condition that binds the socket…
~~~
else if( socketSOCKETISBOUND( pxSocket ) == pdFALSE )
{
/* Bind the socket to the port that the client task will send from.
Non-standard, so the error returned is that returned by bind(). */
xResult = FreeRTOS_bind( ( Socket_t ) pxSocket, NULL, 0u );
}
~~~
xResult becomes zero here, indicating a successful bind.
Back in the connect function, xResult becomes equal to the return value of FreeRTOS_issocketconnected( pxSocket ); which is 0.
The code then finally gets stuck looping in the idle hook after xEventGroupWaitBits() is called.
I am using GCC compiler and am programming on Silicon labs’ IDE ‘Simplicity Studios’.
Thanks for any help!
FreeRTOS sockets not connecting
I am trying to create a simple client/server demo sending small packets across the network using a loopback interface on my EFM32 GG Cortex-M3 microcontroller.
I have copied verbatim the example code given on the freeros website here https://www.freertos.org/FreeRTOS-Plus/FreeRTOSPlusTCP/TCPNetworkingTutorialReceivingTCPData.html and here https://www.freertos.org/FreeRTOS-Plus/FreeRTOSPlusTCP/TCPNetworkingTutorialSendingTCPData.html for sending and recieving.
In my main function I simply call the FreeRTOSIPStart() function (which replaces the FreeRTOSIPInit function) and then starts the threads, main function looks like this:
~~~
void main ( void )
{
CHIPInit();
SWOSetupForPrint();
extern NetworkInterfacet *xLoopbackInterface;
pxLoopbackFillInterfaceDescriptor(1, xLoopbackInterface);