Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Xmega-A3BU Xplained USB Virtual Com Port

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
jynx

Bascom Member



Joined: 28 Apr 2016
Posts: 8

PostPosted: Sat Apr 30, 2016 2:28 pm    Post subject: Xmega-A3BU Xplained USB Virtual Com Port Reply with quote

I am using an Xmega-A3BU Xplained board. The board came pre-loaded with a demo. When you plug the board into USB, it shows up as a XPLAINED Virtual Com Port.
This virtual com port can be used for communication in/out the MCU. How can I program the Xmega with my bascom code, but also using the Virtual Com Port. I know
that this is loaded into the boot section. I have review and tested the Bootloader.bas, but that is just an MCS bootloader. How can I enable the Virtual Com Port when I
compile and upload my bascom program to the Xmega?

(BASCOM-AVR version : 2.0.7.9 , Latest : 2.0.7.8 )
Back to top
View user's profile
Meister

Bascom Member



Joined: 27 May 2010
Posts: 319

blank.gif
PostPosted: Sat Apr 30, 2016 7:03 pm    Post subject: Reply with quote

Programming and communication are different things. As long as the Atmel bootloader is installed, the board can be programmed using Flip and that is supposed to be usable from the Bascom IDE but also stand-alone. But the point is that to enter the Atmel bootloader you have to press the switch SW0 while cycling power. Without having an USB cable with a switch incorporated this is slightly messy... So I prefer programming via PDI or Jtag. From Atmel there are "cheap (from ~40$ up)" ICE programmers that also can be used for On.Chip-Debugging rather than to simulate. With the Xmegas that is very handy to check for example which I/O registers have been set by Bascom. Using those debuggers requires to install Atmel Studio 7 which is rather large thing.

Communication would require to install a driver to the chip to handle the USB peripheral of the chip. As far as I know the Bascom compiler does not support this directly, but an USB-Addon can be purchased.
http://www.mcselec.com/index.php?page=shop.product_details&flypage=shop.flypage&product_id=173&option=com_phpshop&Itemid=1
But on that page Xmegas are not mentioned.

Summary:
Forget about a bootloader and USB communication and use a PDI or Jtag capable programmer from Atmel Studio (having written the code in Bascom, producing a .hex file) and a separate RX/Tx-USB converter (like FT232 or others).
I am doing this at present all the day...It is quite convenient.
Regards, Meister
Back to top
View user's profile
jynx

Bascom Member



Joined: 28 Apr 2016
Posts: 8

PostPosted: Sat Apr 30, 2016 8:12 pm    Post subject: Reply with quote

Thank you for responding Meister. I should of been more clear. I have a JTAGICE3 and can JTAG program from Atmel Studio and Bascom. I am new to using Bascom.
That being said. The demo program that comes pre-loaded on the XMegaA3BU-Xplained board is seen in Windows as a USB virtual serial port. This is all done without the
use of supporting hardware such as an FT232 chip. I would like to know how this could be accomplished either by loading the bootloader section with the proper code to handle
the USB to serial bridge or whatever method makes this possible. The serial output will be used to feed data back to a PC. I would like to do this without additional hardware just
like the pre-loaded board does.
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Sat Apr 30, 2016 9:44 pm    Post subject: Reply with quote

What you want is the CDC xmega implementation. I have been working on that the past period. While i have working code it is not ready for release yet since it is not suited to be combined with other code.
The cdc take relatively much code, about 8 KB. i doubt if that is suited for a boot loader but it could fit into 8KB with some things stripped. It will be handy for an xtra serial port. FLIP bootloader does not use CDC and will fit and is installed already. I also use the xplain board. nice board but odd that the board can not be booted to bootloader more simple.

_________________
Mark
Back to top
View user's profile Visit poster's website
jynx

Bascom Member



Joined: 28 Apr 2016
Posts: 8

PostPosted: Sun May 01, 2016 9:49 pm    Post subject: Reply with quote

Yes I agree that it should be more simple. I will move forward with a chip based solution for now. Thank you for your response.
Back to top
View user's profile
JC

Bascom Member



Joined: 15 Dec 2007
Posts: 586
Location: Cleveland, OH

usa.gif
PostPosted: Wed May 11, 2016 1:32 pm    Post subject: Reply with quote

Quote:
What you want is the CDC xmega implementation. I have been working on that the past period.


Hi Mark,

Excellant!

I'm looking forward to this feature's release!

JC
Back to top
View user's profile Visit poster's website
boeseturbo

Bascom Member



Joined: 23 Jul 2007
Posts: 46

blank.gif
PostPosted: Wed Nov 16, 2016 11:26 am    Post subject: Reply with quote

are there any news on this topic?

Cheers

Jan
Back to top
View user's profile
olhexy

Bascom Member



Joined: 03 Apr 2011
Posts: 192
Location: Tilburg, Netherlands

netherlands.gif
PostPosted: Sat Oct 26, 2019 2:07 pm    Post subject: Reply with quote

Here is an other Xmega-A3BU Xplained user... that thought the USB could be used for Bascom terminal, but no...
I got the board second hand and the bootloader was gone.
I managed to reinstall it with mkii PDI and Studio7. Because I found it hard to find I attached bootloader file.
In studio7 I can now program with FLIP or mkii-PDI.

During the messing around with libusb and (un-)signed USBdrivers I found that Windows10 reboot time was about 2 minutes. I thought I might have done something bad with driver_signature_enforcement ON/OFF or bcdedit.
I did a fresh install of Windows10 (that brought a great cleanup, I needed that!), and after that Studio7 and Bascom2082. Beautiful!
But the Windows10 reboot time did not improve, it's still about 2 minutes. I guess the Windows10 reboot procedures have somewhat changed.
BTW: The Xplained USB does not install fault free by it self. After Studio7 setup libusb0 was added, and then it works.
First thing that I tried to is seeing if I have a COMport for Bascom Terminal... Result: negative.
I anticipated that and already got a FTDI FT232RL board. See picture. This is a very adaptable board.

It is the same solution as Meister suggests.
To be able to use the native USB connection for COM would be much preferred, of course; now it's only a power cable... I still hope that it be possible (for Xmega-A3BU Xplained) in the future.

Meister wrote:
Programming and communication are different things. As long as the Atmel bootloader is installed, the board can be programmed using Flip and that is supposed to be usable from the Bascom IDE but also stand-alone. But the point is that to enter the Atmel bootloader you have to press the switch SW0 while cycling power. Without having an USB cable with a switch incorporated this is slightly messy... So I prefer programming via PDI or Jtag. From Atmel there are "cheap (from ~40$ up)" ICE programmers that also can be used for On.Chip-Debugging rather than to simulate. With the Xmegas that is very handy to check for example which I/O registers have been set by Bascom. Using those debuggers requires to install Atmel Studio 7 which is rather large thing.

Communication would require to install a driver to the chip to handle the USB peripheral of the chip. As far as I know the Bascom compiler does not support this directly, but an USB-Addon can be purchased.
http://www.mcselec.com/index.php?page=shop.product_details&flypage=shop.flypage&product_id=173&option=com_phpshop&Itemid=1
But on that page Xmegas are not mentioned.

Summary:
Forget about a bootloader and USB communication and use a PDI or Jtag capable programmer from Atmel Studio (having written the code in Bascom, producing a .hex file) and a separate RX/Tx-USB converter (like FT232 or others).
I am doing this at present all the day...It is quite convenient.
Regards, Meister
[/img]
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Tue Oct 29, 2019 9:05 am    Post subject: Reply with quote

thanks for sharing. I do not know about windows 10 long boot time. i do know that you need to take care with win10. i had a laptop from family that i wanted to boot in safe mode. but then it turned out i needed a local admin account. And it was impossible to leave the safe mode. So i advise to make a local admin account. otherwise you need network and an MS account. It took a complex operation to get out of this mode.

regarding CDC for xmega. i made a working xmega cdc driver. but the xmega usb architecture uses sram from the xmega. and it requires a lot of code to run. even while it is coded in asm, i could not fit both a CDC driver and bootloader in an xmega boot space. this means this cdc driver is only usable in a normal app. The USB add on is relatively simple to use when you alter the provided samples. it still is not for beginners. and you must be prepared to read info about usb. the xmega usb is more complex. for this reason it is not yet included in the usb add on. i did hand it out to a few customers.
I expect support work from this so i am looking for a good way to solve this.
I also use a dedicated USB UART chip in Xmega designs.

_________________
Mark
Back to top
View user's profile Visit poster's website
olhexy

Bascom Member



Joined: 03 Apr 2011
Posts: 192
Location: Tilburg, Netherlands

netherlands.gif
PostPosted: Tue Oct 29, 2019 11:59 am    Post subject: Reply with quote

Well, I have read http://www.usbmadesimple.co.uk/ums_1.htm
It begins with very good introduction how the signals work, how the USB makes first contact.
I also have read the http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-8331-8-and-16-bit-AVR-Microcontroller-XMEGA-AU_Manual.pdf so I can lookup what registers are to be set.
But what USB procedures are needed and how to implement them... that's somewhat a greenfield for me.
Just the CDC (without FLIP programming) is fine for now. I expect if I have that, then the Xmega-3A3BU Xplained could be used in the same way as I use my STK200's with a serial cable.
This Xmega A3BU has 256kByte, so the code size of USB is not that important.
The programming I will do with PDI mkii.
It is my understanding that just CDC allways works in Windows10 without the driver signing trouble. Is that correct?
I intend to buy the addon though it is not for Xmega. Let's invest some effort and get support to get it working then.

https://www.youtube.com/watch?v=LrwsOX2WSzU shows that the original software already presents a virtual com port as soon as you plug the USB cable in.
If you press the button during plugging in it starts as a FLIP DFUbootloader.
All that software is available in C-code.
The ASF software wizzard applied to the AX3BU Xplained (in Studio7) says: "This example shows how to implement a USB Device CDC on Atmel MCU with USB module. The application note AVR4907 http://ww1.microchip.com/downloads/en/appnotes/doc8447.pdf provides more information about this implementation."
There is a i-notification "atmel_devices_cdc.inf" in the software explorer; a copy of that is here: https://github.com/codebndr/windows-drivers-installer/blob/master/drivers/cdc/atmel_devices_cdc.inf
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum