Indeed, Sebastian is correct - the VirtualSerial demo is just that. If you want a pre-baked USB to Serial converter, there's one in the Projects/ subdirectory:
https://github.com/abcminiuser/lufa-lib/tree/master/trunk/Projects/USBtoSerial
Which acts as a buffered USB to Serial converter out the AVR's USART.
[atlantis:LUFA-120730-BETA/Projects/USBtoSerial] simon% ls
Config Descriptors.o USBtoSerial.c USBtoSerial.h USBtoSerial.o
Descriptors.c Documentation USBtoSerial.d USBtoSerial.hex USBtoSerial.sym
Descriptors.d Doxygen.conf USBtoSerial.eep USBtoSerial.lss USBtoSerial.txt
Descriptors.h LUFA USBtoSerial.inf USBtoSerial.elf USBtoSerial.map makefile
ISR(USART1_RX_vect, ISR_BLOCK)
{
led = (led == 1) ? 0 : 1;
PORTB &= 0xFE;
PORTB |= led;
uint8_t ReceivedByte = UDR1;
if (USB_DeviceState == DEVICE_STATE_Configured)
RingBuffer_Insert(&USARTtoUSB_Buffer, ReceivedByte);
}
To view this discussion on the web visit https://groups.google.com/d/msg/lufa-support/-/Rl1kXIwRK74J.--
You received this message because you are subscribed to the Google Groups "LUFA Library Support List" group.
To post to this group, send email to lufa-s...@googlegroups.com.
To unsubscribe from this group, send email to lufa-support...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/lufa-support?hl=en.
I've tried different terminal programs on different machines, the LED that indicates the m16U2 has received a byte refuses to blink, and the terminal program receives no characters. I know the tiny is sending the data because I can see it on the scope. I'm not sure what else I can configure.
The only time I've ever got any data out of it is when I configured the serial interface (wrongly, as it happens, I forgot to set the 8-bit-data bits) when I wold get a stream of 0xF8 characters. Apart from that, nada.
At this point I'm looking at the couple of bucks I saved by choosing an atmel-USB interface over using an FT232x and I'm thinking "hmmm".
[sigh]
Simon.
Well, it should be correct. The tiny-87 is pushing out '*' characters at 19200, 8-N-1, with 100ms delays in between each. The Mac/Linux box is configured for 19200 8-N-1, and the m16U2 ought not care about its connection to the PC, right? That traffic always runs at USB-bus speed. Both tiny and m16U2 have their clock generated by (separate) external 16MHz crystals, which ought to be accurate enough at 19k2. I've checked that the CLKDIV8 fuse isn't set (even though Lufa turns it off anyway), and it doesn't look like its crashing anywhere (based on the LED coming on and staying on, no blinking as the chip resets or anything like that).
I've tried different terminal programs on different machines, the LED that indicates the m16U2 has received a byte refuses to blink, and the terminal program receives no characters. I know the tiny is sending the data because I can see it on the scope. I'm not sure what else I can configure.
The only time I've ever got any data out of it is when I configured the serial interface (wrongly, as it happens, I forgot to set the 8-bit-data bits) when I wold get a stream of 0xF8 characters. Apart from that, nada.
At this point I'm looking at the couple of bucks I saved by choosing an atmel-USB interface over using an FT232x and I'm thinking "hmmm".
[sigh]
Simon.
--
You received this message because you are subscribed to the Google Groups "LUFA Library Support List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/lufa-support/-/hTbokA2nI-EJ.
Don't worry I'm sure together we will be able to make the demo work.
The m16U2 cares a lot about the pc connection, as that LineEncoding Event is fired only when your board is connected via usb. If that event is not fired your mcu will neither configure nor enable the uart or the receive interrupt and so your interrupt does not have any chance to get fired. The traffic between PC and m16U2 runs indeed with usb speed and there is no baudrate or anything else you have to worry about. the CLKDIV8 fuse can't be the problem, the clock frequency is correct, otherwise the device would not enumerate. So are you sure your uart gets configured? You could also try configuring it manually to see if there is everything correct with just the uart. In this case you should remove the uart code from that LineEncoding Event.
I accidently sent this answer to Simon only, so I resend it here:
Okay then I have some other suggestions what you could do to encircle the issue:- Have you tried rebuilding the project? I mean with a complete clean of all compiled stuff? I sometimes have issues with code that maybe not properly compiled because of whatever.
- Did you comment out the line in the makefile that specifies the usbkey board? It should have no effect, but just to be sure
- Your uart setup code looks fine to me, but just to be sure have you tried disabling the X2 option? also trying to setup a very small baudrate on both chips may help identifying the problem?
- Try to setup the uart for sending and probe with your scope, if it actually sends data and if the setup baudrate is met. If something is wrong with your controller hardware it might show up there as well
- Is everything correct with your power supply? I've had weird problems when using a cheap wall wart (i.e. I couldn't program the chip via ISP ). Did you place bypass capacitors at the chips power pins?
- How do you program the chip? USB bootloader(I think the interrupts in general should be working. otherwise enumeration of usb would fail)? ISP? If isp is connected while the application is running it can cause problems in rare cases depending on the programmer you use.