Adding printf() to USB CDC/MSC Example Project

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I'm using Atmel Studio 7.0.1931 on Windows 10 with a SAME70 Xplained board.

 

I've been working my way through the ASF example projects. I've studied how to use printf() through the EDBG virtual COM port, in example projects such as CHIPID, and they are all working fine for me.

 

My application will be most similar to the USB Composite CDC/MSC example. I'm trying to add support for printf() statements to the code, but after a few days of struggling, I'm not really getting anywhere. I think there is some sort of clash between the UART/USART and Serial STDIO code/drivers.

 

Here is what I'm doing:

 

1) File / New Example Project...

 

2) Device Family: SAME70. Load project: USB Composite Device Example CDC and MSC. Select SAME70 / ATSAME70Q21.

 

3) Build / Build Solution.  Project compiles and works fine.

 

4) Project / ASF Wizard. Standard Serial I/O (stdio) (driver). Add >>.  Apply.

 

5) Build / Build Solution. The build fails with errors:

unknown type name 'usb_cdc_line_coding_t'  …..   src\uart.h 49
 

unknown type name 'sam_uart_opt_t'   ….. src\ASF\common\services\serial\sam_uart\uart_serial.h 91

Following these through, I can find the implementation of usb_cdc_line_coding_t in src\ASF\common\services\usb\class\cdc\device\usb_protocol_cdc.h. Also, sam_uart_opt_t is in src\ASF\sam\drivers\uart\uart.h.  Putting #includes in doesn't seem to help me, and I just get even more errors from elsewhere in the code.

 

This is before I even initialize the console port and start using printf() in the code.

 

Can anyone suggest where I'm going wrong?

Last Edited: Sat. Sep 8, 2018 - 07:56 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can anyone suggest where I'm going wrong?

The stdio module you are including in your project applies to the USART, not the USB CDC.  You need to use the cdc_stdio service.  How you add MSC to that is beyond me...

 

 

Greg Muth

Portland, OR, US

Xplained/Pro/Mini Boards mostly

 

Make Xmega Great Again!