Hi,
I am using CMSIS RTOS on my project. This project also contains Keil HTTP server.
#define osFeature_MainThread 1 ///< main can be thread
then RTOS will starts main on startup/power on. I can debug it fine but when I power off then power on again. It does not startup
My code is here
int main (void) {
netInitialize (); netSYS_SetHostName (_net_name); netDHCP_Enable(0); netHTTPs_Start (); //osThreadCreate (osThread(RunLeds),&guileds);
osTimerId id; // timer id id = osTimerCreate (osTimer(RunLeds), osTimerPeriodic, &guileds); osTimerStart (id, 1); // start timer osThreadCreate (osThread(RunRelayThread), relay);
osThreadCreate (osThread(RunCommsThread), gwbuilder_);
// display_id = osThreadCreate (osThread(Display), NULL); /* Main terminates here - all other threads remain running */ while(1) { guileds.led(4)->set(); osDelay (1000); } }
Do I need to do
int main (void) { if (osKernelInitialize () != osOK) { // check osStatus for other possible valid values // init }
if (!osKernelRunning ()) { // is the kernel running ? if (osKernelStart () != osOK) { // start the kernel // kernel could not be started } } }
I can seen in debug that osKernelStart () get calls but return immediately. So I need infinite loop to make it running.
Kindly advise me my mistakes.
So basically to clarify.
My questions
1- Do I need to calls "osKernelInitialize" and "osKernelSatrts"? 2- Is "osKernelStarts" is blocking calls? 3- Do I need infinite loop at the end of main. 4- Keil HTTP/Net init and starts needs to be called? "netInitialize" and "netHTTPs_Start"
Thanks, Naeem
Find some other examples, analyze and review...
ok, I will review samples related with http/tcp.
I found out I have to put delay of atleast 100ms before calling netInitialize then it works.
osDelay (100);
netInitialize (); netHTTPs_Start ();
while(1) { osDelay (1000); }
return 0; }
View all questions in Keil forum