AnsweredAssumed Answered

stm32f107 lwip freertos printf problem

Question asked by Erkan Ersoy on Dec 19, 2016


I am trying to implement FreeRTOS 9.0.0 and lwip2.0.0 with HAL library and GCC

For easiness I generated FreeRTOS code with STM32CubeMX and replaced FreeRTOS to 9.0.0 and then added LWIP. 

I can ping my device without using debug options enabled.

 to use debug output I wrote that write function:


/*Low layer write(output) function*/
__attribute__ ((used))
int _write(int file, char *ptr, int len)

HAL_UART_Transmit(&huart5, ptr, len, 0xff);


But I had problem with HAL_Delay function and couldn't figure out to get rid of it. (I read tried some solutions but didn't work)


Then I decided if I use write function without HAL_delay may solve my problem so I used :


int _write(int file, char *ptr, int len)

int i=0;

/* Transmit Data */
for (i = 0; i < len; i++) {
UART5->DR = (*ptr++ & (uint16_t)0x01FF);
while(UART5->SR & USART_SR_TC_Msk == RESET);

But it didn't work. (Didn't stuck either.)


How should I use printf function ?