Pages: [1]   Go Down
Author Topic: SAM-BA, BOSSA etc - no connection  (Read 907 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
God Member
*****
Karma: 1
Posts: 530
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

I haven't posted this in the Due forum, as I know there's a few people on these forums working with other SAM chips, and it's a general SAM question.

I've written some code in Atmel Studio, and I want to now program my Due board over USB, with the native USB port using either SAM-BA or BOSSA.

SAM-BA I beleive is a little cumbersome trying to build your own board definitions, so I'm trying to use BOSSA.

However, BOSSA simply just gives me an error message of 'could not find a device', thus I can go no furthur... However, when the board is plugged in, COM9 does appear as a Serial port in BOSSA, I just can't connect to it.

I've got the driver that comes with SAM-BA installed, which I believe is USB CDC driver to allow the USB to act as a virtual COM port.

Any ideas?
Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 13
Posts: 257
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I see you couldn't wait for me to answer your question in the other thread.. Anyway.. To answer your question about bossac.. If your programming the chip through the built-in USB interface use the following command:

Quote
bossac.exe --port=COM9 -U true -e -w -v -b YOUR_FILE.bin -R

Otherwise, if your programming through a FTDI (like the Due programming port), use this command instead:

Quote
bossac.exe --port=COM9 -U false -e -w -v -b YOUR_FILE.bin -R

//Basel
Logged

UK
Offline Offline
God Member
*****
Karma: 1
Posts: 530
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I see you couldn't wait for me to answer your question in the other thread..

I thought I was a little close to threadjacking - and that a new thread may help others in the future. smiley

I've just tried this, and all I get is 'bossac.exe is not recognised as an internal or external command, operable program or batch file.'

the YOUR_FILE bit? Is that just a file name, or does it have to be the file location and name, for example C:\Users etc?

I've found a guide to integrate this into Atmel Studio, https://sites.google.com/site/arduinodueatmelstudio/home/integrating-bossac-in-atmelstudio but when I execute it, I just get 'SAM-BA operation failed'.

I've got the CDC driver installed so that the native USB port appears as 'AT91 USB to Serial Converter' in device manager.

If I have -U true, I get 'Erase Flash, No Such File or Directory', if it's -U false I get the above 'SAM-BA operation failed'.
« Last Edit: August 03, 2013, 06:36:05 am by jtw11 » Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 13
Posts: 257
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I see you couldn't wait for me to answer your question in the other thread..

I thought I was a little close to threadjacking - and that a new thread may help others in the future. smiley

I've just tried this, and all I get is 'bossac.exe is not recognised as an internal or external command, operable program or batch file.'

the YOUR_FILE bit? Is that just a file name, or does it have to be the file location and name, for example C:\Users etc?

The following error: 'bossac.exe is not recognised as an internal or external command, operable program or batch file.', means that you're not in the root directory of bossac when you call the command.. You'll have to "cd" into that directory before you call the command.. You'll find bossac somewhere in the sam folder (arduino ide folder)..

The YOUR_FILE.bin is just the compiled binary file for your sketch (Just like avr chips uses hex files)....

Edit: I just saw your edited post.. I'll have to get back with a proper solution, because I'm still at work.. I will look at my setup at home and report back..  Still if you know how to compile your sketch/project and manage to call bossac, my instructions above will work without any problems..

//Basel
« Last Edit: August 03, 2013, 06:40:24 am by baselsw » Logged

UK
Offline Offline
God Member
*****
Karma: 1
Posts: 530
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay, I've just cd'd my way into the direction from a command window, and used the BOSSAC command as follows

Code:
bossac.exe --port=COM8 -U true -e -w -v -b Led_Blink.bin -R

However, I still get the error message of 'Erase Flash No such file or directory'

Does that mena, no such file of Led_Blink.bin? because that file is not located in the directory that bossac.exe is in, it's elsewhere?

I'll quickly try moving it there...

EDIT - Moving the .bin file into the Bossac directory now works and writes the flash succesfully, although my code does not work.

Just trying to switch off the onboard LED using ASF... The LED just stays on. smiley-grin Joys.
« Last Edit: August 03, 2013, 06:57:42 am by jtw11 » Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 13
Posts: 257
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good work.. =D.. The pin mapping in ASF is kinda strange.. If you want, you can post your code and the board type you chose in atmel studio and I'll look into it.. But I'm sure that you can manage to figure it out on your own..

//Basel
Logged

UK
Offline Offline
God Member
*****
Karma: 1
Posts: 530
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm using Atmel Studio 6.1, so the Due is a standard board in the IDE.

The code I'm using is as follows.

Code:
#include <asf.h>

#define MY_LED IOPORT_CREATE_PIN(PIOB, 27)

int main (void)
{
board_init();
ioport_init();

ioport_set_pin_dir(MY_LED, IOPORT_DIR_OUTPUT);

while(1)
{
ioport_set_pin_level(MY_LED, false);
}
}

The Due schematic looks like PWM13 is on PB27, pin 68, which is connected to the onboard 'L' LED through an op-amp. I can't for the life of me see why this won't turn off that LED. Switching false to true makes no difference.

EDIT - Just hit the reset button, and the LED switched straight off. Changed the code to true, and the LED stays on, good. Problem sorted (though I don't understand why reset should make a difference)

Onto the next problem, blinking the LED.

When I try to build the following, I get the error "Error   1   implicit declaration of function 'delay_ms' [-Werror=implicit-function-declaration]   C:\Users\Julian West\Documents\Atmel Studio\6.1\Led_Blink\Led_Blink\src\main.c   42   3   Led_Blink"

Code:
#include <asf.h>

#define MY_LED IOPORT_CREATE_PIN(PIOB, 27)

int main (void)
{
board_init();
sysclk_init();
ioport_init();

ioport_set_pin_dir(MY_LED, IOPORT_DIR_OUTPUT);

while(1)
{
ioport_set_pin_level(MY_LED, true);
delay_ms(1000);
ioport_set_pin_level(MY_LED, false);
delay_ms(1000);
}
}

It seems like it's missing an include or something?

EDIT, AGAIN - Ah, got it - I hadn't clicked 'apply' in the ASF Wizard when importing the delay routines, now the delay function appears highlighted as a proper red function.

Again however, after writing to the board - the LED dosen't flash, not until you press the reset button, then it begins to flash. I believe a reset post programming is needed to remove the device from boot from ROM mode to boot from flash.

So, with that problem sorted - I'm trying to get BOSSAC working as an external tool within Atmel Studio, save me typing the command in everytime I want to flash the chip.

If I type the exact command as follows into a cmd window, it works perfectly and flashes the chip.

Code:
--port=COM8 -U true -e -w -v -b Led_Blink.bin -R

If I type exactly the same into Atmel Studio however, I just get the error "no such file or directory"...

Hmm, will need to work on this.

EDIT, Okay - One step futhur...

For an external tool, set the Name as something like "BOSSAC on COM8"

For the command, set the directory and name of the BOSSAC application, for example C:\Users\John Doe\Desktop\arduino-1.5.2\hardware\tools\bossac.exe
For the arguments, set --port=COM8 -U true -e -w -v -b Led_Blink.bin -R
For the Initial Directory set the same as command, without the application, for example C:\Users\John Doe\Desktop\arduino-1.5.2\hardware\tools\

With the above setup, the .bin file to be burned must be within the same folder as bossac.exe, and you must manually type the .bin name into the argument. I'm sure there must be a way to make the tool automatically take the directory and file name from the debug folder of the Atmel Studio output files...

Still, the above is faster than typing the whole thing.

Another edit - Okay, I've just realised too, earlier when I was having to reset the board to make the newly flash application run, it was because I had forgotten the -R command at the end of the BOSSAC command, which signals a CPU reset. If you do not use -R, you will have to press the reset button after flashing. If you include -R, you won't. Simple.

Even with all the above, I cannot get either the BOSSA or SAM-BA GUI's to connect to the board at all. Still, at least we know that one could build a simple Windows app that calls on BOSSAC for in-field upgrades of code on devices running SAM3X chips.
« Last Edit: August 03, 2013, 08:58:37 am by jtw11 » Logged

Pages: [1]   Go Up
Jump to: