cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L462CE FreeRTOS not running

AP_040
Senior

I have generated code from CubeMX for STM32L462CE controller for using the RTOS but it is not working as expected. I attached the CubeMX file. Is there any setting missed in CubemX? Please help me.

1 ACCEPTED SOLUTION

Accepted Solutions
AP_040
Senior

Now, I solved the issue.

Generated new Embedded C project from the IDE and Use tiny printf/sprinf/fprintf (small code size). So, it will generate the tiny_printf.c file and using this file to in my own project, it has successfully worked.

View solution in original post

11 REPLIES 11
AP_040
Senior

Can anybody help me?

Thread switching is not happening. In fact, in thread when we put debug print, it will display only one time then it is stuck.

AP_040
Senior

I got the issue. I am using vsnprintf() to print the data on UART so, it is creating issue. However, if I am using HAL_UART_Transmit() to print any string, it is working fine.

So, now what I have to do? if I want to use debug printing on UART? Can someone give me the solution?

Do you provide for an adequate stack for the vsnprintf()?

Here we tend to either use sprintf() and enqueue data for the USART, or use register level code in the fputc() function for Keil to use stdio.

You could perhaps also try to use SWV channel for diagnostic output.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
AP_040
Senior

Thanks for your help..

@Community member​  No, I am not providing an adequate stack for the vsnprintf(). How I do that? Please help me.

"use register level code in the fputc() function for Keil to use stdio"

I am using the TrueStudio for my development. So, can you help me how I use register level code?

AP_040
Senior

Hi @Community member​ Can you please help me on all possible solution to do this?

>>Can you please help me on all possible solution to do this?

I'm not sure I want to get that deeply involved into your work tasks, I have plenty of my own to be doing.

//****************************************************************************

void OutChar(char c)

{

 while((USARTx->ISR & USART_ISR_TXE) == 0); // Wait for Empty

 USARTx->TDR = c; // Send Char

}

//****************************************************************************

void OutString(char *s)

{

 while(*s)

 {

  while((USARTx->ISR & USART_ISR_TXE) == 0); // Wait for Empty

  USARTx->TDR = *s++; // Send Char

 }

}

//****************************************************************************

// Hosting of stdio functionality through USART/SWV

//****************************************************************************

/* Implementation of putchar (also used by printf function to output data)  */

int SendChar(int ch)          /* Write character to Serial Port   */

{

 OutChar((char)ch);

 ITM_SendChar(ch); // From core_cm4.c

 return(ch);

}

//****************************************************************************

//****************************************************************************

// KEIL

//****************************************************************************

#include <rt_misc.h>

#pragma import(__use_no_semihosting_swi)

struct __FILE { int handle; /* Add whatever you need here */ };

FILE __stdout;

FILE __stdin;

int fputc(int ch, FILE *f) { return (SendChar(ch)); }

int ferror(FILE *f)

{

 /* Your implementation of ferror */

 return EOF;

}

void _ttywrch(int ch) { SendChar(ch); }

void _sys_exit(int return_code)

{

label: goto label; /* endless loop */

}

//****************************************************************************

//****************************************************************************

// GNU

//****************************************************************************

int __io_putchar(int ch) { return (SendChar(ch)); }

//****************************************************************************

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
AP_040
Senior

Thanks for your help @Community member​ .

I am not perfectly understood this. It is better if you provide some example for this. I am using STM32L462CE and Attollic studio IDE.

Initialize your diagnostic USART as you would normally.

Use the GNU routine for Atollic. These routines are not dependent on HAL or interrupts/callbacks, and work on L4 platforms.

With GCC, small printf (option LD Linker->Libraries->Small printf set to 'Yes') calls __io_putchar()

Use these to debug/diagnose issues you face with the more complex issues.

>>I am using STM32L462CE and Attollic studio IDE.

Yes, and I'm not, you're using tools and a board I don't have.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
AP_040
Senior

Hello @Community member​  I have not found any option in Properties->C/C++ Build--> Setting-->Tool Setting to set this "With GCC, small printf (option LD Linker->Libraries->Small printf set to 'Yes') ".