cancel
Showing results for 
Search instead for 
Did you mean: 

What is the best way to enable Debug messages for USB Host?

Not applicable

After selecting the USBH_DEBUG_LEVEL option with a value of 3 (Middleware > Parameter Settings > USBH_DEBUG_LEVEL) and adding these subroutines below (BEGIN 4 / END 4), the messages have not yet been displayed on the serial monitor. Only after adding a message (BEGIN 2 / END 2) in the main routine the Debug messages were displayed correctly.

 (main.c file:)

/* USER CODE BEGIN 4 */
int __io_putchar(int ch) {
	uint8_t c[1];
	c[0] = ch & 0x00FF;
	HAL_UART_Transmit(&huart1, &*c, 1, 10);
	return ch;
}
 
int _write(int file, char *ptr, int len) {
	int DataIdx;
	for (DataIdx = 0; DataIdx < len; DataIdx++) {
		__io_putchar(*ptr++);
	}
	return len;
}
/* USER CODE END 4 */

 (main.c file:)

int main(void)
{
...
  /* USER CODE BEGIN 2 */
  USBH_UsrLog("Power On");  // <--------------- ???
  /* USER CODE END 2 */

This happens from version 1.0 to version 1.4 of the STM32CubeIDE !?

0 REPLIES 0