2014-11-24 04:21 PM
Hi All,
I'm using the tools as per the subject.Can you advise how I can configure printf to trace to a serial terminal?Currently I'm using a Nucleo board (Nucleo L053R8) but soon I'm moving on to Discovery (STM32F429).Any help is really appreciated!Regards,Balas #stm32 #printf #discovery2014-11-24 04:38 PM
Can't help you with Cube, probably want to ponder using the [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/AllItems.aspx]other forum
[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/printf%20keil%20stm32%20eval2%20board&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=79]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2Fprintf%20keil%20stm32%20eval2%20board&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=79 There's also the SWO pin and SWV[DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Discovery/ADC3%20converting%203%20inputs%20%2B%20display&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F¤tviews=276]https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FSTM32Discovery%2FADC3%20converting%203%20inputs%20%2B%20display&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F¤tviews=2762015-01-26 02:51 PM
Hi,
Here a simple HelloWorld,/* Includes ------------------------------------------------------------------*/
#include ''stm32f3xx_hal.h''/* USER CODE BEGIN Includes */#include <stdio.h>/* USER CODE END Includes *//* Private variables ---------------------------------------------------------*/UART_HandleTypeDef huart1;/* USER CODE BEGIN PV *//* USER CODE END PV *//* Private function prototypes -----------------------------------------------*/void SystemClock_Config(void);static void MX_GPIO_Init(void);static void MX_USART1_UART_Init(void);/* USER CODE BEGIN PFP *//** * @brief Retargets the C library printf function to the USART. * @param None * @retval None */int fputc(int ch, FILE *f){ /* Place your implementation of fputc here */ /* e.g. write a character to the USART */ HAL_UART_Transmit(&huart1,(uint8_t*)&ch,1,1);// 1 tick waiting (1ms) enough for 87us/byte at 115200 return ch;}/* USER CODE END PFP *//* USER CODE BEGIN 0 *//* USER CODE END 0 */int main(void){ /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration----------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* Configure the system clock */ SystemClock_Config(); /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_USART1_UART_Init(); /* USER CODE BEGIN 2 */ //HAL_SuspendTick(); // comment because needed for timeout /* USER CODE END 2 */ /* USER CODE BEGIN 3 */ /* Infinite loop */ printf(''Hello from STM32CubeMX\n''); while (1) { } /* USER CODE END 3 */}Regards,Régis2015-05-09 10:29 PM
rn,
That works great...thanks a ton for the post!Joe