lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] stm32 ethernet interrup priority


From: Noam Weissman
Subject: Re: [lwip-users] stm32 ethernet interrup priority
Date: Sat, 20 Aug 2016 18:25:19 +0000

Hi,


Yes you have a problem...


Cortex-M3 has a priority level mechanism a bit different from other micro's.

In FreeRTOS its a bit not clear...


Your FreeRTOS time tick is interrupt driven and has a priority.

Also all your devices interrupts have priorities.


In FreeRTOS you have function calls that are used in your application code and similar function

that can be called from interrupt (prefix FromISR...)


In order to have a stable code running with FreeRTOS you must set all interrupts that may need to

be stopped by the OS to have a lower interrupt priority.


Cortex interrupt priority

15 lowest

.

.

.

0  highest


If you set your OS time tick interrupt priority to 5 your UART, TCP etc must be set to 5 + something.

If you do not set it like that you will get strange behavior.


I suggest downloading an ST example and see how they set it properly.


Good luck,

Noam.



From: lwip-users <lwip-users-bounces+address@hidden> on behalf of Erkan Ersoy <address@hidden>
Sent: Saturday, August 20, 2016 12:54 PM
To: Mailing List for LwIP Users
Subject: [lwip-users] stm32 ethernet interrup priority
 
Hello;

I am trying to implement usart interrupt to my project 

So iread freertos stm32 interrupt warnings and set i lilk that

/* Enable the Ethernet global Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = ETH_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =2;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);

//USART 5 interrupt
NVIC_InitTypeDef NVIC_InitStruct;
NVIC_InitStruct.NVIC_IRQChannel = UART5_IRQn;
NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;
NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = configMAX_SYSCALL_INTERRUPT_PRIORITY;
NVIC_InitStruct.NVIC_IRQChannelSubPriority = 1;
NVIC_Init(&NVIC_InitStruct);

But I begin to have system freezes so i changed it like that 

/* Enable the Ethernet global Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = ETH_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = configMAX_SYSCALL_INTERRUPT_PRIORITY;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);

//USART 5 interrupt
NVIC_InitTypeDef NVIC_InitStruct;
NVIC_InitStruct.NVIC_IRQChannel = UART5_IRQn;
NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;
NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = configMAX_SYSCALL_INTERRUPT_PRIORITY;
NVIC_InitStruct.NVIC_IRQChannelSubPriority = 1;
NVIC_Init(&NVIC_InitStruct);

Now I don't have a problem. The diffference is ethernet interrupts. I didnt have a problem until i added the usart interrupt. And I look at ST's freertos examples they set it to 2. 

is there something wrong with my current code that will cause problem in the future?
(I will move UART5 task to USART1 after I finish writing functionality)

Thank you 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]