Can FLIP kill my device connectivity?

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

This has happened on three devices in a row: I connect a PCB with an ATmega16u4 to FLIP, with success. I load in my firmware -- verified. I click 'Start Application', and my board starts humming away. What a great thing!

 

But. Now none of them can connect via FLIP (no USB device; nothing in Device Manager either), and ISP can't get the signature or connect either. It gives this error:

 

 

I can't get into bootloader mode, either. Maybe I'm missing something there. I thought I could program on the fly like Arduino, but it seems I need to set some that up on the firmware side. I can't get there with hardware, either. I've got HWB pulled down via 10k, and Reset pulled up via 20k. I shorted Reset to ground for a moment, just to try to enter bootloader. Alas, nothing. 

 

Any ideas? 

 

My goal is to be able to update firmware in the field via USB, but now I can't update them at all!

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

Is HWB or BOOTRST being used? If HWB then obviously you need to pull on the HWB pin at power on to keep it in the DFU bootloader. Othewise it goes straight to app. When there was no app (so that whole section contained 0xFFFF) then execution kind of treats 0xFFFF as NOP (really more like SBRS R13,7 in fact!) so it just fell all the way through until it hit the bootloader anyway. But if the system is designed to use HWB (and that fuses is set) then now you need to "ask" it to go to the DFU at power on. Designs that use HWB usually have a button on the HWB pin that you hold at power on to bring it back into DFU.

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

I have HWB pulled low. Shouldn't that direct it to bootloader? I tried also pulling it high at power up, to no avail. 

 

I haven't changed any fuses, since ISP can't see the chip anymore. 

 

Any idea why ISP is unable to see it at all? I've been testing and programming these boards via ISP until now, and everything was good. It's only after clicking 'Start Application' in FLIP that things go sideways. 

 

I've looked all over, but I can't find any good examples on how to set up the USB DFU, so that I can provide power, but also be able to program in the field (like Arduino). It seems like it should be obvious, or easy, but maybe I'm spoiled by Arduino. Would it just be easier to just load in the Arduino Micro bootloader or something? Seems like cheating or giving in though :)

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

JeanRimbaud wrote:
It's only after clicking 'Start Application' in FLIP that things go sideways.
An alternative to FLIP is

dfu-programmer

http://dfu-programmer.github.io/

JeanRimbaud wrote:
Would it just be easier to just load in the Arduino Micro bootloader or something?
something ... one of which is Dean's LUFA USB DFU bootloader instead of Microchip's AVR USB DFU bootloader.

jumping to dfu bootloader and stay there

by dwidd2

https://www.avrfreaks.net/forum/jumping-dfu-bootloader-and-stay-there

 

Edit: 1st URL

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Tue. Jul 10, 2018 - 06:03 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JeanRimbaud wrote:
Would it just be easier to just load in the Arduino Micro bootloader ...
a variant of Dean's LUFA USB CDC bootloader.

Do you require the speed of USB DFU or USB CDC?

Reason: Atmel-ICE goes via USB HID (max 64KB/sec) for programming and debugging.

ubaboot is a USB megaAVR bootloader that's very small and goes via low-speed USB (max 1.2Mb/sec)

GitHub - rrevans/ubaboot: USB bootloader for atmega32u4 in 512 bytes

https://github.com/rrevans/ubaboot

ubaboot doesn't have a Windows loader due to the custom USB descriptor.

Windows 10 Pro and subsequent have Windows Subsystem for Linux (WSL) so WSL may be one way to use ubaboot's loader.

If Windows 10 Home then it's a bit of effort with the Windows variant of libusb.

 


https://github.com/arduino/ArduinoCore-avr/tree/master/bootloaders/caterina

 

"Dare to be naïve." - Buckminster Fuller

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

Dang, I'm going to have to work for it? :)

 

Any idea how FLIP is killing my ability to connect or see the chip, or even read the device ID via ISP? 

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

No idea ... a guess is a JRE issue (IIRC FLIP is a Java app) or a JRE mis-match (FLIP may malfunction with more recent JRE)

Seems there's a Java update onto Windows several times a year.

Could not locate FLIP at Microchip; FLIP was relatively easy to locate at Atmel.

 

"Dare to be naïve." - Buckminster Fuller

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

An alternative to FLIP is

atprogram

Microchip

Microchip

Atmel Studio 7

http://www.microchip.com/webdoc/GUID-ECD8A826-B1DA-44FC-BE0B-5A53418A47BD/index.html?GUID-CF4ED1DB-2805-4CF0-A576-622C00126D89

...

 

Atmel Studio 7.0.582

...

  • Support for Flip-compatible bootloaders in atprogram and programming dialogue. The connected device appears as a tool.
  • ...

 

"Dare to be naïve." - Buckminster Fuller

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

AVRDUDE 6.3

AVR Downloader/UploaDEr - News: AVRDUDE 6.3 released [Savannah]

http://savannah.nongnu.org/forum/forum.php?forum_id=8461

...

 

* New programmers supported: 

...

- Atmel DFU, using FLIP protocol version 1 (AT90USB and ATmega*U* devices), 
or version 2 (Xmega devices) 

...

 

"Dare to be naïve." - Buckminster Fuller

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

Update:

 

I didn't realize Studio could see the actual bootloader as a tool. So I'm able to load in initial firmware with Studio, and it runs as expected.

 

My new struggle is with being able to start in bootloader mode for a few seconds on power/ reset. I'm not going to have access to a button or hardware once these are in cases. I think I have to change the BOOTRST fuse, but to do that I need to disable the lockbits. To do that, I need to erase the chip.... which also erases the bootloader. I feel like I'm banging my head against something that is obvious, and tons of people use all the time, but I can't see it. 

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

JeanRimbaud wrote:
I'm not going to have access to a button or hardware once these are in cases.
Modify the existing USB DFU bootloader to not sense a signal but to wait for a 'go' message; modify the application to add a 'reset' message.

jumping to dfu bootloader and stay there

by dwidd2

https://www.avrfreaks.net/forum/jumping-dfu-bootloader-and-stay-there

Will the operator be able to cycle USB VBUS? (remove and re-insert the USB cable, or, command that hub's USB port's VBUS)

"Dare to be naïve." - Buckminster Fuller

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

The existing DFU bootloader is the one that came with the Atmega16u4. I can't modify that, can I? I looked for it on the Googlewebs, but it doesn't seem available. 

 

Going with a new bootloader like LUFA seems very involved. I'm still trying to wrap my head around all the bits and pieces that would have to be installed with what tools and modified how and where, whatnot. If the only path is down that rabbithole, though, I will do that.

 

Out of curiosity, how does Arduino allow you to interrupt the application at any time and load in new firmware via USB? 

 

Will the operator be able to cycle USB VBUS? (remove and re-insert the USB cable, or, command that hub's USB port's VBUS)

Yes.  

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

JeanRimbaud wrote:
I can't modify that, can I?
You can modify it ... Microchip's megaAVR USB DFU source code may be in Atmel Studio.

The thread quoted in the previous post may link to it or in a thread from it.

JeanRimbaud wrote:
Out of curiosity, how does Arduino allow you to interrupt the application at any time and load in new firmware via USB?
Don't know; will attempt to locate the Arduino USB DFU bootloader source code.

Edit :

Arduino goes via USB CDC instead of USB DFU; upload and run in the Arduino IDE.

https://github.com/arduino/ArduinoCore-avr/tree/master/bootloaders/caterina

https://www.arduino.cc/en/Guide/ArduinoLeonardoMicro#toc7

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Fri. Jul 27, 2018 - 08:11 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JeanRimbaud wrote:
I looked for it on the Googlewebs, but it doesn't seem available.
Quickly located only the hex files :

http://ww1.microchip.com/downloads/en/DeviceDoc/megaUSB_DFU_Bootloaders.zip (28KB)

datasheet for those megaAVR USB DFU bootloaders :

http://ww1.microchip.com/downloads/en/DeviceDoc/doc7618.pdf

via https://www.microchip.com/wwwproducts/en/ATmega32U4

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Fri. Jul 27, 2018 - 08:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JeanRimbaud wrote:
. I thought I could program on the fly like Arduino

 

I think you could if you burned the Arduino bootloader....

 

Jim

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

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

AVR1916 (think it is from memory) has the source for DFU. It uses IAR but as all the projects build to 4K or less (to fit) you can use the free "kickstart" version rather than having to pay $3000 for the full IAR. Small mods that don't bloat the code should still build / fit OK.
.
EDIT while this might not be exactly what you want to do it gives a taste of how 1916 (confirmed!) can be modified...
.
http://www.hilltop-cottage.info/blogs/adam/xmega-dfu-bootloader-changing-the-sensing-pin/

Last Edited: Sat. Jul 28, 2018 - 05:49 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JeanRimbaud wrote:
I think I have to change the BOOTRST fuse, ...
then the mega16U4 will stay in the USB DFU bootloader until the USB DFU loader sends a DFU_DNLOAD  sequence to start the application.

USB DFU Bootloader Datasheet

http://ww1.microchip.com/downloads/en/DeviceDoc/doc7618.pdf

(page 3)

Boot Reset Fuse

...

(page 13)

4.10 Starting the Application

...

via https://www.microchip.com/wwwproducts/en/ATmega16U4

The PC-side of this would be some thought.

 

"Dare to be naïve." - Buckminster Fuller