This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
I have downloaded the HTTP example from
and I have followed the guidelines from
(I have used a freshly generated RM57/FreeRTOS project as a source of settings to copy) to integrate support for FreeRTOS into this project.
I was able to successfully merge the two worlds, except that only one of them can be active. That is, the HTTP server is operational provided that the FreeRTOS kernel is not started. When the kernel is started, no HTTP operation takes place.
The vTaskStartScheduler() call is added right after invocation of http_init(), as in the following stripped (and actually tested) example:
int main(void)
{
unsigned int ipAddr;
struct in_addr devIPAddress;
char * txtIPAddrItoA;
gioInit();
sciInit();
IntMasterIRQEnable();
_enable_FIQ();
uint8 ip_addr[4] = { 192, 168, 11, 112 };
uint8 netmask[4] = { 255, 255, 255, 0 };
uint8 gateway[4] = { 192, 168, 11, 254 };
ipAddr = lwIPInit(0, emacAddress,
htonl(*((uint32_t *)ip_addr)),
htonl(*((uint32_t *)netmask)),
htonl(*((uint32_t *)gateway)),
IPADDR_USE_STATIC);
devIPAddress.s_addr = ipAddr;
txtIPAddrItoA = (char *)inet_ntoa(devIPAddress);
LocatorConfig(emacAddress, "HDK enet_lwip");
printf("IP address: %s\n", txtIPAddrItoA);
pbuf_init();
httpd_init();
printf("Start\n");
char testChar;
sciReceive(sciREG1, 1, &testChar);
printf("Starting kernel \n");
vTaskStartScheduler();
return 0;
}
The call to sciReceive exists only so that the time of invoking the kernel is controlled by the user. The HTTP server works fine until the kernel is started, after that it is not responsive any longer.
I am able to run regular tasks in this setup, which indicates that the FreeRTOS was integrated properly - except for some detail that I seem to be missing.
What are your suggestions?
Hi Rex,
The web server stops responding to requests as soon as the scheduler starts. The scheduler itself works properly and can manage regular tasks (if created).
I was able to reduce the example even further, by extracting the first basic LwIP calls (bind, listen, accept, recv) and use them without the complete webserver code, just to detect the network-induced activity and to make it easier to play with the debugger. The whole LwIP instance from this example seems to be entirely based on interrupts and my impression is that this mechanism is obscured (or "hijacked") by the running RTOS scheduler.
I have also noticed that the version of LwIP provided in this example is prepared for non-RTOS operation. It might be very well the case that by using (although not yet intentionally mixing) the two in a single program I expected more than is actually supported.
Having said that, it would be great to see a working example of a program that actually runs the LwIP stack *from* the FreeRTOS, because that level of integration is what I ultimately need. That would put this board and software stack immediately on par, regarding networking, with other LaunchPads of the TivaC or SimpleLink kinds. Hey, that would be also a motivation to use some more up to date version of LwIP, because the 1.4.1 version is somewhat out of date.
Or, when we are at it, why not TI-RTOS/NDK on Hercules? Is there any particular reason this is not provided (neither in Resource Explorer nor in HalCoGen)?
In any case, I will explore the third-party options (as listed on the Hercules pages) as well.
Best Regards,
Maciej
Hi, Maciej,
I am not sure what was the decision that TI-RTOS wasn't on Hercules back then. However, we do have LWIP example running on Hercules:
and there were other customers running FreeRTOS+LWIP:
https://e2e.ti.com/support/microcontrollers/hercules/f/312/t/190805
You may want to refer to the FreeRTOS+LWIP example where main() creates 2 tasks in sys_main.c. Task1 starts LWIP, and task2 toggles HET[1] with timer ticks. Then vTaskStartScheduler() is called. Give it a try to see if it helps.
Rex
Hi Rex,
The first link that you have suggested leads to *exactly* the same repository that I referred to in my original post. This is the example that I have tried to integrate with FreeRTOS - and failed.
The discussion from your second link contains the following:
"We do not have an integration of lwIP & FreeRTOS for Hercules. And we do not have plans for such an integration."
"I'm also trying to get lwIP working with FreeRTOS on a TMS570 MCU. But I'm not successful until now."
"Actually even i'm trying to port FreeRTOS with ethernet from quite long time. It has never worked. And also, i couldn't get much help from TI as well."
And even though somewhere very deep there is a slight trace of somebody almost succeeding, it is not very encouraging. Especially on a board that is supposed to target the reliability and quality-conscious audience.
As I have already said, I will try with alternative software stacks.
Best Regards,
Maciej