how can i program AT91SAM7x256

Microchip in-system programming solution: SAM-BA

Moderators: nferre, fab

mail2ario.list
Posts: 8
Joined: Tue Jan 27, 2009 9:53 pm

how can i program AT91SAM7x256

Tue Jan 27, 2009 9:58 pm

Hi.
I have searched a lot and did not find a complete post about how to program AT91SAM7x256 chip.
Can anyone please tell me:
Where is the JTAG programmer schematic (For AT91SAM7x series not 7S)
What is the software that works with that programmer.
How long my JTAG cable must be?
Thanks a lot.
mail2ario.list
Posts: 8
Joined: Tue Jan 27, 2009 9:53 pm

Re: how can i program AT91SAM7x256

Thu Jan 29, 2009 10:56 am

Any idea?
mail2ario.list
Posts: 8
Joined: Tue Jan 27, 2009 9:53 pm

Re: how can i program AT91SAM7x256

Thu Jan 29, 2009 11:12 am

I have searched google and found that it must be at91sam-ice jtag emulator and SAM-BA software.
But how can i build at91sam-ice cable my self?
Or we only have right to program our own micro controllers by paying to Atmel corporation for its programmers?
dariens_haircut
Posts: 23
Joined: Fri Jul 25, 2008 12:08 am

Re: how can i program AT91SAM7x256

Thu Jan 29, 2009 6:53 pm

For just programming without debug, you can use SAM-BA. Either via USB or using the DBGU UART. For USB, the crystal must be the frequency specified in the datasheet (18.something MHz). Also, to get the chip end of SAM-BA running on boot, you need to have the GPNVM2 bit clear, which is the case after chip erase (and thereafter unless you set it). SAM-BA doesn't need JTAG. You can use just a plain old USB cable or serial port (logic level or RS232 level shifted depending on your board).

JTAG is a different beastie, and the cable/adapter you need will be dictated by the software that you want to use to drive it. For debugging, you will need JTAG and you will need to gain an understanding of what JTAGSEL does.
mail2ario.list
Posts: 8
Joined: Tue Jan 27, 2009 9:53 pm

Re: how can i program AT91SAM7x256

Thu Jan 29, 2009 8:41 pm

Thanks a lot dariens_haircut!
But the question is still unanswered.
Where is the schematic of COM port programmer so I can build it myself and I want to.
I need schematic of that COM port programmer works with SAM-BA.
Thanks again.
dariens_haircut
Posts: 23
Joined: Fri Jul 25, 2008 12:08 am

Re: how can i program AT91SAM7x256

Thu Jan 29, 2009 11:03 pm

Ok, so I assume here that by COM port programmer, you mean a level shifter to go from RS232 signaling levels to the logic levels of the DBGU pins, and that your board does not already have such hardware. If your board has a 9 pin D connector for the DBGU interface, it probably already has it. I know nothing about your board other than that it has an AT91SAM7X256 on it.

Perhaps you want something like this: http://sodoityourself.com/max232-serial ... converter/ It and similar information can be found by googling for things like "max232", as that is a popular chip used for such level shifting. Pay attention to the logic level supply needed by some chips. Some work only with 5v and some only with 3.3v. Often, it is just a matter of choosing another chip from the same family.

That is not the only way to do this. There are other circuits. Some of them use similar chips witih built-in charge pumps. Some need external positive and negative supplies for the RS232 levels. Some do tricks which steal power from the signal lines like this: http://www.sparkfun.com/datasheets/Prot ... ter-v2.pdf

This subject is not at all peculiar to the AT91 family.
mail2ario.list
Posts: 8
Joined: Tue Jan 27, 2009 9:53 pm

Re: how can i program AT91SAM7x256

Fri Jan 30, 2009 11:56 am

Thanks again dariens_haircut.
I just bought an AT91SAM7X256 and soldered it on a simple two layer board with 2 lines of pin headers to connect chip pins to another solder-less board.
I then wire-rapped chip pins to capacitors and a 3.3v supply and also a 20MHz crystal.
I can build RS232 level shifter with MAX232. I am familier with that.
In AT91-ISP guide it comes that we must have AT91SAM7X256 chip that runs SAM-BA Boot to work with Comport or USB. If so I still need a jtag programmer to program SAM-BA Rom on my newly bought chip. If it doesn't matter then you mean I must just connect my chip by a MAX232 to my computers COM Port and then program it with SAM-BA? No SAM-BA Boot needed?
Without any other things to do?
Thanks again.
gerhardf
Posts: 554
Joined: Thu Dec 02, 2004 2:28 pm

Re: how can i program AT91SAM7x256

Fri Jan 30, 2009 1:51 pm

hello,
SAM-BA is already included in the rom of the chip!
and at the at91sam7x family sam-ba is active when GPNVM Bit 2 is set to 0 (which is the default value).
so don't forget to set GPNVM Bit 2 after flash programming!

btw: i would recommend a "professional" eval board for your first steps, because the hardware considerations for that chip are a little bit higher than for some hobbyist µc like avr or pic.

regards
gerhard
dariens_haircut
Posts: 23
Joined: Fri Jul 25, 2008 12:08 am

Re: how can i program AT91SAM7x256

Fri Jan 30, 2009 4:00 pm

mail2ario.list wrote:I just bought an AT91SAM7X256 and soldered it on a simple two layer board with 2 lines of pin headers to connect chip pins to another solder-less board.
I then wire-rapped chip pins to capacitors and a 3.3v supply and also a 20MHz crystal.
That could work. If you get really lucky. It's hard enough to get the crystal to start oscillating with a proper PCB, much less wire wrap. Even if it does oscillate, it might not do so at the correct frequency. And, of course, any resistance/inductance in the wiring diminishes the effectiveness of supply bypassing. Similar issues might affect the PLL filter negatively. When designing like this, one usually needs to at least put those parts of the circuit on a PCB with the controller (and as close to it as possible), even if everything else is an EMI nightmare of flyleads.
mail2ario.list wrote:In AT91-ISP guide it comes that we must have AT91SAM7X256 chip that runs SAM-BA Boot to work with Comport or USB.
The 7X comes with SAM-BA in ROM. That is what you are selecting/deselecting with the GPNVM2 bit, which I mentioned previously. If that bit is cleared, the chip is running the ROM on reboot. If that bit is set, the chip is running whatever you have burned into FLASH on reboot.
mail2ario.list
Posts: 8
Joined: Tue Jan 27, 2009 9:53 pm

Re: how can i program AT91SAM7x256

Sun Feb 01, 2009 9:15 pm

Thank you all men!
By your assists I have found that SAM-BA is enabled by default. So i can program my chip ba COM Port programmer.
But i have downloaded H-JTAG software too.
And after build my own JTAG programmer it recognized my chip as ARM7TDMI chip. Fills like my jtag programmer works.
Know i want to program my chip with a simple program to blink some leds on some io pins.
If i just download my hex file from address 0x00000 of flash memory is my controller works fine? Or it will boot from SAM-BA ROM again?
What does SAM-BA do after it detects that microcontroller is not connected to COM Port or USB? is it trying to jump to flash memory of chip to run my own part of code?
Thank you so much.
dariens_haircut
Posts: 23
Joined: Fri Jul 25, 2008 12:08 am

Re: how can i program AT91SAM7x256

Sun Feb 01, 2009 10:44 pm

mail2ario.list wrote:If i just download my hex file from address 0x00000 of flash memory is my controller works fine? Or it will boot from SAM-BA ROM again?
I suspect that this may be some unfortunate usage of language. Forgive my pedanticness, but precision is important in subjects such as this. I'll assume, for the sake of moving the discussion along, that you actually mean that you want to flash an image into the chip and that you want it to run when the chip is reset.

Note that the FLASH doesn't begin at address 0x0. You might get lucky through a series of coincidences and end with something that works due to the remapping, but I wouldn't count on it. FLASH starts at 0x100000.

You should study the parts of the datasheet which discuss the memory map and the remapping feature of the memory controller.

If you really meant that you were extracting an existing binary image from the FLASH in the chip; that operation, by itself, would have no effect on the performance on the chip later on, being merely a read. And doing such a copy from address 0x0 will only get you a FLASH image if the FLASH (and not the internal SRAM) is mapped there.
mail2ario.list wrote: What does SAM-BA do after it detects that microcontroller is not connected to COM Port or USB? is it trying to jump to flash memory of chip to run my own part of code?
The SAM-BA code in ROM is just a command interpreter. It does not jump to any address to run code unless you tell it to do so by issuing a particular command. It just sits there waiting for COM port or USB connections and executing commands issued over such connections.

JTAG is almost completely different from SAM-BA. The only thing you need to know from the SAM-BA discussion for that is to set GPNVM2 if you want your code in FLASH to run on reset. With that bit set, the SAM-BA code in ROM will not run at all. Just your code in FLASH. Which is probably what you want. It does mean that after chip erasure, you'll have to set the GPNVM2 bit again. Whatever you're using to drive your JTAG adapter might already take care of that for you, but I cannot know.
mail2ario.list
Posts: 8
Joined: Tue Jan 27, 2009 9:53 pm

Re: how can i program AT91SAM7x256

Tue Feb 03, 2009 5:09 pm

Thank you Dennis. Sorry for my bad English! If your first language was not English and your English speaking was not so good and you were in middle of night and very tired of reading forums, eBooks, datasheets, etc then maybe you were talking like me :lol:
By the way. I have downloaded Blinker sample projects hex file from Keil uVision samples directory (C:\Keil\ARM\RV30\Boards\AT91SAM7X256-EK\Blinker) right into address like 0x10000 (the default address in software) to my chip by H-JTAG software.
Thanks god. I have soldered some LEDs to my Chip pins and its now blinking! Just like described in that project.
So my problem is solved by now.
But after all I want you to ask one more question:
Do you think H-JTAG have configured my chips GPNVM2 bit to 1 by default? (Cause I did not have seen any word like this in its menus and windows. Just programmed and it worked)
Thank you man.
God bless you!
dariens_haircut
Posts: 23
Joined: Fri Jul 25, 2008 12:08 am

Re: how can i program AT91SAM7x256

Tue Feb 03, 2009 5:37 pm

mail2ario.list wrote:If your first language was not English and your English speaking was not so good and you were in middle of night and very tired of reading forums, eBooks, datasheets, etc then maybe you were talking like me
That possibility is why I was nice about it and explained why I was being so picky. What really bothers me is people who have English as their first, if not only, language and still cannot communicate properly. I usually try to read past errors which do not change the meaning of something, but when there is ambiguity or something just doesn't make sense, I have to ask.
mail2ario.list wrote:But after all I want you to ask one more question:
Do you think H-JTAG have configured my chips GPNVM2 bit to 1 by default?
I don't know. I have never used that program. It very well might. It would be sensible for it to do that, at least by default. Or there might be a script (for SAM7X targets, for instance) that does it. If that bit were not set in one way or another, your firmware would never run on chip reset; so it has gotten set somehow.
mail2ario.list
Posts: 8
Joined: Tue Jan 27, 2009 9:53 pm

Re: how can i program AT91SAM7x256

Fri Feb 06, 2009 6:55 pm

Thanks a lot dariens_haircut. And good wishes.
You solved my problem.

Return to “SAM-BA”

Who is online

Users browsing this forum: No registered users and 1 guest