USB Serial issue

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
User avatar
Mantas
Posts: 221
Joined: Tue May 15, 2012 10:32 pm
Location: Klaipeda, Lithuania - North sea, UK
Has thanked: 57 times
Been thanked: 27 times
Contact:

USB Serial issue

Post by Mantas »

Hi,

I get this compilation error when I try to use USB serial COMS on ARM devices. I suppose only PICs are supported?

Code: Select all

In function 'FCD_01_USB_Serial1__Initialise':
warning: implicit declaration of function 'USBDeviceInit'
error: 'USB_BUS_SENSE' undeclared (first use in this function)
error: (Each undeclared identifier is reported only once
error: for each function it appears in.)
warning: implicit declaration of function 'USBGetDeviceState'
error: 'DETACHED_STATE' undeclared (first use in this function)
warning: implicit declaration of function 'USBDeviceAttach'
error: 'USBDeviceState' undeclared (first use in this function)
error: 'CONFIGURED_STATE' undeclared (first use in this function)
BR,
Mantas
Science is my true religion.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: USB Serial issue

Post by Benj »

Hi Mantas,

Yes the USB components only support the PIC devices at the moment. Could do with a better error message there.

Would you like to see the USB components on the ARM? Would be a bit of work so probably can't work it in today but should be possible. AVR would also be possible but tricky.

User avatar
Mantas
Posts: 221
Joined: Tue May 15, 2012 10:32 pm
Location: Klaipeda, Lithuania - North sea, UK
Has thanked: 57 times
Been thanked: 27 times
Contact:

Re: USB Serial issue

Post by Mantas »

Hi Benj,

Yes! I would love to see it, I am missing that very much, and it would be nice to see all chips with this. Benj, I think there are source codes for all USB functionality in ATMEL website, you could download it. I am not a USB guru like you so for me it's a bit difficult to implement it, but for you I think it will be much easier :)

http://www.atmel.com/Images/at91sam7s-ek.zip

Best regards,
Mantas
Science is my true religion.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: USB Serial issue

Post by Benj »

HI Mantas,
for you I think it will be much easier
I wouldn't count on it :wink:

I'll add it to the list and see what I can do. I've looked at supporting AVR devices with a bit banged USB stack before but the timings get so tight that you have to be a guru just to design your program to run alongside the USB mechanisms. At least with PICs all the USB comms is done with hardware so simplifies things vastly.

User avatar
Mantas
Posts: 221
Joined: Tue May 15, 2012 10:32 pm
Location: Klaipeda, Lithuania - North sea, UK
Has thanked: 57 times
Been thanked: 27 times
Contact:

Re: USB Serial issue

Post by Mantas »

I always count on you :D Well ARM's also support hardware USB and has a designated FIFO registers for that, so I think it's more or less the same as with PIC's. Let me know how it goes for you :)

Cheers,
Mantas
Science is my true religion.

EtsDriver
Posts: 444
Joined: Tue Apr 15, 2014 4:19 pm
Location: Kajaani, Finland
Has thanked: 345 times
Been thanked: 227 times
Contact:

Re: USB Serial issue

Post by EtsDriver »

Ive been waiting for months for this kind of support for AVR devices... :P Now ill raise this topic up again. You Ben should take look at the Arduino Leonardo, which uses AtMega32u4 processor, has usb capability. I have so many projects that now use usb<-->RS232 conventers, but these 232 conventers work somewhat... not so well in industrial enviroment ill say.

All those blown converters and burn expensive pcb's came back to haunt me ._.
Ill just keep the good work up!

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: USB Serial issue

Post by Benj »

Hello,
You Ben should take look at the Arduino Leonardo, which uses AtMega32u4 processor, has usb capability.
Ok thanks for letting me know, I will get one ordered today and see if I can make some headway on this.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: USB Serial issue

Post by Benj »

Hello,

I have been looking into the USB demo code for the ATMEGA32U4 device and though the code looks simple enough it is all based on loops with strict timings.

The PIC USB stuff is all interrupt driven so you can basically just initialise it and then let it get on with what it needs to do.

The AVR USB stuff on the other hand seems to be based on polling and this means it's very hard to craft into a simple component that will play nice with the current USB Serial, HID and Slave components in Flowcode. That's not to say the chips don't support the nice interrupt modes, only that the example code doesn't seem to use them.

To add further problems there are multiple different versions of the USB hardware in the AVR range and the demo code only generally addresses one or two of the versions.

Serie 2 |AT90USB162,AT90USB82, ATmega32U2, ATmega16U2, ATmega8U2
Serie 4 |ATmega32U4, ATmega16U4
Serie 6 |AT90USB1286, AT90USB646, ATmega32U6
Serie 7 |AT90USB1287, AT90USB647

So I'm not admitting defeat but it looks like implementing these is a much bigger job than originally anticipated. I'll continue on with this today and see where I can get to but I'm not holding my breath.

...

Another option is to use LUFA but this seems to rely on the fact that you can change the makefile script to include all the LUFA pre-built libraries. Again not nice. I will keep looking.

Post Reply