Difference between revisions of "Serial Debugging"

From Stm32World Wiki
Jump to navigation Jump to search
(Created page with "Category:STM32Category:STM32 DevelopmentCategory:STM32CubeMXCategory:STM32CubeIdeCategory:STM32 HAL{{metadesc|How to redirect printf to USB Serial Port}} R...")
 
Line 4: Line 4:
 
<pre>
 
<pre>
 
int _write(int file, char *ptr, int len) {
 
int _write(int file, char *ptr, int len) {
CDC_Transmit_FS((uint8_t *)ptr, len);
+
    CDC_Transmit_FS((uint8_t *)ptr, len);
 
     return len;
 
     return len;
 
}
 
}
 
</pre>
 
</pre>

Revision as of 04:15, 30 April 2021

Redirecting printf to a Virtual COM port is really easy:

int _write(int file, char *ptr, int len) {
    CDC_Transmit_FS((uint8_t *)ptr, len);
    return len;
}