LUFA dual boot problem

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

Hi,

 

I am currently developing a "dual boot" for the 16U2 based in LUFA, what I have is a program that reads the MOSI pin of the 16U2 when started and if it is at a LOW level it starts a USB-Serial communication but if it is HIGH is starts a USB-MIDI communication.

That switching works perfect, the computer recognizes the two diferent situations(a COM port when LOW and an Audio Controller when a HIGH), the MIDI communication works well also, but the problem is that the Serial communication doesn't.

It looks like there is a problem when it initializes it, I want to have a serial communication with a Visual Studio c# app that I have build but when I try to connect the app with the 16U2, Visual Studio teports an error at the port opening function. I have tried with the same PCB, but the factory firmware(Arduino USB-Serial) and it works correctly, so thats my point that the thing that isn't working correctly is my LUFA firmware.

 

It is based on LUFA 140928, here I upload the full folder, where I have my project is on \lufa-LUFA-140928\Projects\arduino_midi

 

Thank you so much in advance

Best regards

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When you attach your device to the USB bus, do you see the virtual serial port on the host?  If using Windows, look in Device Manager.

 

I haven't looked at a .rar file in many years, and I don't want to try now.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

steve17 wrote:

When you attach your device to the USB bus, do you see the virtual serial port on the host?  If using Windows, look in Device Manager.

 

I haven't looked at a .rar file in many years, and I don't want to try now.

 


Hi
Yes, It appears in the device manager and It os shown as It hasn't any problems but when I try yo connect It with my app It reports a fail when openning the serial port

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is your PC program trying to connect to the correct serial port?

 

I would try to connect with a terminal emulator program.

 

As I remember, the serial port number can vary whenever you plug the device in. 

 

You can set the port number to what you want and it will stay there.  Right click on the Device Manager entry. Then click on  Properties.  Then click on Port Settings tab, Advanced.  Set the COM Port Number.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

steve17 wrote:

Is your PC program trying to connect to the correct serial port?

 

I would try to connect with a terminal emulator program.

 

As I remember, the serial port number can vary whenever you plug the device in. 

 

You can set the port number to what you want and it will stay there.  Right click on the Device Manager entry. Then click on  Properties.  Then click on Port Settings tab, Advanced.  Set the COM Port Number.

 

 

Yes it tries to connect to the correct one because I can choose in the app which device I want to stablish the connection to, and if I try to connect it to an Arduino it does it correctly, but if I try to connect to my device it reports the error openning the serial port.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd try to reduce the complexity of the problem - forget all the multi-mode stuff for now. just put a simple LUFA based CDC test program into the 16U2 and see if you can get that to communicate with the PC. Does that simple test work?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

I'd try to reduce the complexity of the problem - forget all the multi-mode stuff for now. just put a simple LUFA based CDC test program into the 16U2 and see if you can get that to communicate with the PC. Does that simple test work?


Yes, I tried with the only serial bootloader of an Arduino and It works

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't mean Arduino  - I mean to start with a SIMPLE project from LUFA and verify that works.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Thank you all for the help, I solved it by starting a new empty project and now it works, here I paste you the code if someone would like to use it:

https://github.com/hachimbala/AVR-LUFA-Dual-Bootloader/tree/master