We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
Here is my program which sends a UDP package each 100us(micro-second).
int32_t socket; uint8_t *sendbuf; void Time3(void){ TIM_TimeBaseInitTypeDef TimeStruct; NVIC_InitTypeDef nvicStructure; NVIC_PriorityGroupConfig(NVIC_PriorityGroup_3); nvicStructure.NVIC_IRQChannel = TIM3_IRQn; nvicStructure.NVIC_IRQChannelPreemptionPriority =1; nvicStructure.NVIC_IRQChannelSubPriority = 0; nvicStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&nvicStructure); RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3,ENABLE); TimeStruct.TIM_Prescaler=35; TimeStruct.TIM_Period=200; ///200=100us TimeStruct.TIM_ClockDivision=TIM_CKD_DIV1; TimeStruct.TIM_CounterMode= TIM_CounterMode_Up ; TIM_TimeBaseInit(TIM3, &TimeStruct); TIM_Cmd(TIM3, ENABLE); TIM_ITConfig(TIM3,TIM_IT_Update,ENABLE); } /*########################################### ##############Main Function################## ###########################################*/ void job3 (void const *argument) { netInitialize(); } osThreadDef(job3, osPriorityAboveNormal, 1, 0); void SetSCK(){ socket = netUDP_GetSocket(udp_cb_func); if (socket >= 0) { netUDP_Open(socket,0); netUDP_SetOption (socket, netUDP_OptionTTL, 20); } } int main (void){ CLOCK(); GPIO_SetBits(GPIOA,GPIO_Pin_5); LongDelay(); osKernelInitialize (); osThreadCreate (osThread(job3),NULL); osKernelStart (); LongDelay(); Time3(); GPIO_ResetBits(GPIOA,GPIO_Pin_5); do { osDelay(500U); netIF_GetOption(NET_IF_CLASS_ETH | 0, netIF_OptionIP4_Address, (uint8_t *)&addr, sizeof (addr)); } while (addr == 0U); SetSCK(); while (1) { if(Alarm==1) { Alarm=0; Ethers(); } } } void Ethers(void){ NET_ADDR addrUDP={ NET_ADDR_IP4, 5022, 192, 168,1,10}; if(socket>=0){ CheckAlarm=0; Data(); sendbuf = netUDP_GetBuffer (Ether.Size); memcpy (sendbuf, MSG, Ether.Size); State=netUDP_Send (socket,&addrUDP,sendbuf,Ether.Size); } void TIM3_IRQHandler(){ CheckAlarm=CheckAlarm+1; Alarm=1; TIM_ClearITPendingBit(TIM3, TIM_IT_Update); }
My program hangs after some seconds before using a thread for "netInitialize();" function. After adding a new thread for netInitialize() (Job3) it shows me this error
OS_ERROR_TIMER_OVF:
I need to know how to solve this problem.
----------
As I checked the fault reposrts windows debault fault shows me Halted flag is on.
You've already posted this in your other thread:
https://community.arm.com/developer/tools-software/tools/f/keil-forum/46373/my-mcu-jumps-to-os_idle_demon-after-some-seconds-network-stm32f/164537#164537
to save people wasting time answering in that thread, please go and update that post to point here!
Also, mark that thread as answered.