Ok lets talk some TinyG2/V9

Ok lets talk some TinyG2/V9. @Alden_Hart @Riley_Porter_ril3y

I have been bugging the crap out of John trying to clarify the simplest of questions. You see I always look the info offered literally, and this often over complicates things for me.

Anyways here is a set of instructions given to flash the TG2/V9 via the Arduino Due IDE. (link there https://github.com/synthetos/g2/wiki/Flashing-G2-with-Windows)

Step 3a - Program TinyG2 onto the Due Using Arduino Tools

From Cmd line they say to Change Directory to

-> cd %ProgramFiles% (x86)\Arduino\hardware\tools

After that go ahead and run these commands.
–> mode COM6 BAUD=2400
Then -> bossac.exe --port=COM6 -e -w -v -b %HOMEPATH%\Downloads\TinyG2_Due_rob_usbtest.bin -R

OK, I get what is happening. I am supposed to sub the COM6 for my COM. Easier said then done. First off it was not clear how to get the TinyG2/v9 board to even be recognized by window as a com.

The only way I could do it was to copy the TinyGv2.inf from git hub to my pc, then update the driver for the TinyGv2 that was populated two times in the “Other Devices” of the Windows device manger (Yellow triangle with Exclamation). I hat to Right Click and manually update driver. I had to browse to the TinyGv2.inf and load it as a driver. It was then that one of the two TinyGv2 “Other Devices” icons become a port 10 device called TinyG v2 (Control Channel) (COM10) you can see it here http://gyazo.com/77fd4d29264fb931550defaef1397c52 . That only took and hour or so to figure out, lol

So now I am supposed to run " mode COM6 BAUD=2400 " but sub my com. "mode COM10 BAUD=2400 " This defines COM10’s baud rate to 2400 correct?

Next I am supposed to run " bossac.exe --port=COM6 -e -w -v -b %HOMEPATH%\Downloads\TinyG2_Due_rob_usbtest.bin -R"

Well I have no bossac.exe in the ProgramFiles(x86)\Arduino\hardware\tools folder. I am running the latest Arduino IDE 1.6.5 r2. and the only place I can find anything that says bossac is bossac.inf and its C:\Program Files (x86)\Arduino\drivers in a zip folder called Old_Arduino_Drivers.zip

Can you please break down this string for me.
bossac.exe --port=COM6 -e -w -v -b %HOMEPATH%\Downloads\TinyG2_Due_rob_usbtest.bin -R"

Correct me if I am wrong, since we are in the C:\Program Files (x86)\Arduino\hardware\tools directory, that command is trying to run the bossac.exe (but I don’t have this .exe) next it defines the port for the TinyGv2 (again mine is COM10), then I have no clue what -e -w -v -b is, (can someone explain please), next it defines the HOMEPATH to the compiled G2 code base, which from that string says look in the downloads folder for a file called TinyG2_Due_rob_usbtest.bin, and and load it to the TGv2 board.

Again, please can someone tell me what the -e -w -v -b are called, and what they do. Lastly at the end of the string I see a -R, that must be reset right?

Guys, I am not a real coder and I do not have a lot of experience working in cmd line. I want to learn so I can at least explain it well enough in a video so others that know even less than I (if that’s possible, lol) can get an easier start using these boards.

In summary, I don’t have a bossac.exe, and if I do, its for sure isn’t located in the ProgramFiles(x86)\Arduino\hardware\tools folder. I am happy I have TinyGv2 on Com10. I am going to see if I can putty in, or coolTerm in… Just as I started to get a handle on V8, now I am on V9… This is a good thing, and I cant wait to share my journey.

I just wanted to let you know I didn’t flash the board, but it is working in Chilipeppr, and running G-Code. . Here is the pastebin of the V9 dump http://pastebin.com/hMrjs7xa

The bad news is $fb=65.01 is ancient. The last time I built G2 Edge I built $fb=83.07 and I know it it beyond that now.
I recommend you get a working build environment up and running, a non-trivial exercise. That may get you a more up to date bossac install as well.
Spend some time reading thru items at https://github.com/synthetos/g2/issues , open and closed.
Several items relating to getting the build environment are informative, both open and closed.

This info help ?

carl@HPDV7-Linux:~> bossac -h
Usage: bossac [OPTION…] [FILE]
Basic Open Source SAM-BA Application (BOSSA) Version 1.3a
Flash programmer for Atmel SAM devices.
Copyright © 2011-2012 ShumaTech (http://www.shumatech.com)

Examples:
bossac -e -w -v -b image.bin # Erase flash, write flash with image.bin,
# verify the write, and set boot from flash
bossac -r0x10000 image.bin # Read 64KB from flash and store in image.bin

Options:
-e, --erase erase the entire flash
-w, --write write FILE to the flash; accelerated when
combined with erase option
-r, --read[=SIZE] read SIZE from flash and store in FILE;
read entire flash if SIZE not specified
-v, --verify verify FILE matches flash contents
-p, --port=PORT use serial PORT to communicate to device;
default behavior is to auto-scan all serial ports
-b, --boot[=BOOL] boot from ROM if BOOL is 0;
boot from FLASH if BOOL is 1 [default];
option is ignored on unsupported devices
-c, --bod[=BOOL] no brownout detection if BOOL is 0;
brownout detection is on if BOOL is 1 [default]
-t, --bor[=BOOL] no brownout reset if BOOL is 0;
brownout reset is on if BOOL is 1 [default]
-l, --lock[=REGION] lock the flash REGION as a comma-separated list;
lock all if not given [default]
-u, --unlock[=REGION] unlock the flash REGION as a comma-separated list;
unlock all if not given [default]
-s, --security set the flash security flag
-i, --info display device information
-d, --debug print debug messages
-h, --help display this help text
-U, --force_usb_port=true/false override USB port autodetection
-R, --reset reset CPU (if supported)

Report bugs to bugs@shumatech.com

Another item FYI - I don’t really understand why the Windows instructions call for changing Baud=2400, when the Linux instructions call for 1200 baud. I believe 1200 baud is the magic rate for the Due boot loader to recognize download mode. You could try that while I dig deeper.

Also, give this item a look: https://github.com/synthetos/g2/issues/86

Thanks for the definitions, heck thanks for all the info. I really do want to flash the V9 with the latest code base, however I find it difficult to follow the instructions.

First off, I was confused with the TG2/V9 getting started. . https://github.com/synthetos/g2/wiki/Getting-Started-with-G2 In the things needed section, it had me really messed up. I didn’t realize that the V9 board want available to the public just yet, doh. I was baffles as to why I needed a Arduino Due, a Shield, and a Programmer. Now I understand.

Next up was getting the V9 to even talk to the PC. How to use the TinyGv2.inf was a mystery due to several conflicting directions given in the various GitHub issue trackers. IMO, It should say TinyGv2_driver.inf this would at least offer a cle as to what this file is intended for.

As to the build environment, I have set up several different build environments. Never have I used Avrdude other than via the actual Arduino IDE, but in there you don’t issue the command manually (typing it in) . I have setup up Cygwn to compile targets for CleanFlight, I also have set up Eclipse. I have Git-Bash installed, I have the GUN verison of Make installed, I have VIM installed, I have GCC-ARM installed (gcc-arm-none-eabi-4_8-2014q). I have not started a dev folder for the TGv2/V9 project, so I do not have a path set for GCC-ARM.

I did however try to build in Windows, see here --> http://pastebin.com/ED25kFeT and here -> http://pastebin.com/jCiS79eR

I see there isnt a windows dev environment establised for the TinyG, so I plan to go (painfully) thru each error of my failed builds, starting at the top, to try and define a new dev environment for windows.

As with all the other stuff I do, when I learn exactly what to do. I will document it with a step by step video to show others exactly what to do. I wish there was an easier way to collaborate in real time. This would save me hundreds of hours tying to answer the simplest of questions. Questions like what exactly do you do to get a TInyGv2 to connect to a PC. :slight_smile:

So the adventure begins for what seems like such a simple task. How to compile and flash a TinyGv2/V9 in Windows. (http://lmgtfy.com/?q=How+to+compile+and+flash+a+TinyGv2%2FV9+in+Windows)

Isnt the TinyGv2/V9 just an Arduino Due with basically a shield built in? If so, shouldn’t we just be working in an Arduino Dev environment?

Last thing, what version of Arduino do you have installed? Does it have that bossac.eve in the tool folder?

@cmcgrath5035 you said, “Also, give this item a look: https://github.com/synthetos/g2/issues/86” I am on windows. However I may get some clues. Thx for the link.

@Thomas_Shue DUE and tinyGv9 are related but use different implementations of the chips. I have no experience with the Arduino environments, its the ATMEL Dev environment that works best. See https://github.com/synthetos/g2/issues/53 for a summary of my adventure solving the install of Studio 6.2. Clearly some of the core pieces (avrdude, bossa) are used by both, not clear to me if those are Almel or Arduino developed.
A key item to find in the reference is that to reflash the V9, you have to erase flash frirst - shorting solder bumps with a screwdriver (etc.)

I have to add the caveat that I do not compile in Studio 6.2, but had to install it to run the Atmel-ICE(which in the end I really didn’t need). I do my builds under Linux. I assume you have reviewed https://github.com/synthetos/g2/wiki/Compiling-G2-on-Windows-(Atmel-Studio-6.2)?

@Thomas_Shue I went ahead and used the windows instructions you posted to update a v9 (or due + g2) and they are not working either. It looks like the first problem is the bossac file path has changed in Arduino. I will see if I can update the wiki tomorrow and get it updated to reflect how to do all of this for g2.

Awesome… So I am not crazy! Where did you find the Bossac.exe? I looked all over. T

@Riley_Porter_ril3y Riley, while you are into this , why do the Win instruction call for changing baud to 2400 rather than the 1200 baud called for in the Linux version? I am of the understanding that 1200 baud is the magic value to trigger the erase (by the bootloader).
Also, read my last entry in this thread https://github.com/synthetos/g2/issues/86 My tentative conclusion was, and is, that the download procedure for G2/DUE and G2V9 are not the same, which I have attributed to the V9 not having the DUE’s programming port interface with the dedicated boot interface device. The result seemed to be that the 1200 baud switch does not trigger the erase, which must be (easily) done manually.

@Rob_Giseburt ​ can u answer @cmcgrath5035 ​ email. @Thomas_Shue ​ no I could not. However I have a fix just need to write it down and verify this tonight.

Riley - Here is a cut-pastes from my G2 Issues post
/
I have to conclude that https://github.com/synthetos/g2/wiki/Flashing-G2-with-Linux does not apply to the tinyGV9k when a version of tinyG2 is running. To enable bossac for an update from 83.07 to 83.08, I had to do the “screwdriver across the erase solder bumps and reset”. After that, the LEDS onboard change, G2 stops heartbeating and lsusb reports an Atlmel device.
Bossac then runs without the 1200 baud dance. Download was fast, and after power cycle G2 heartbeat begins.
/

Hi guys, I just fixed the Wiki page for Windows (that you linked to in the OP). The problem is that the BAUD needs to be 1200.

BTW, the way it works is this (Linux):

  1. Set the port baud to 1200
  2. Open and close the connection.
  3. The firmware sees a connection close (DTR signal goes low) while configured to 1200 baud, it’ll hit the “ERASE” button from software and reset into the SAM_BA Loader.

The SAM-BA loader (that bossac talks to) is NOT a boot-loader - it’s effectively an alternative firmware that resides in the chip’s ROM. Once you’re switched to it, you need to talk to it to load a new firmware into FLASH and then switch the boot into FLASH.

The problem with Windows (this time): The DTR signal is not automatically altered during connection and disconnection. That means you have to specifically toggle the DTR signal. I believe, by luck, the mode commend does toggle that signal, so it works. Riley is working on a script to make this simpler as we speak.

If you are on a Arduino Due, you can get the same effect as all that (^^^) by holding the ERASE button while resetting the board with the Reset button.

I hope that helps a little.

@Thomas_Shue I figured out another way. I flashed my v9 but have not written up all of the instructions. However in short. Get bossac here:

https://github.com/synthetos/arduino-flash-tools/archive/master.zip

Then you can pretty much follow the old guide as it was (ignore arduino stuff). Also I compiled a 83.0 edge for the v9 (not the DUE g2 port but for the v9 that you have) You can get the bin here:

http://synthetos.github.io/g2/

Note you have a v9k. I will try to finish the instructions tomorrow night. Just ran out of time tonight. But this IS doable. However lacking in specifics :slight_smile:

@Thomas_Shue I also got your board back. Yup you did not have a bootloader. I slapped one on there, then used the tg-updater. All worked fine :slight_smile: Thanks for getting that back so i could figure out what was going on.