Starting a Board From Bare Metal, Need Low level Init Help

Microchip in-system programming solution: SAM-BA

Moderators: nferre, fab

jumbo013
Posts: 2
Joined: Fri Nov 22, 2013 9:07 pm

Starting a Board From Bare Metal, Need Low level Init Help

Fri Nov 22, 2013 9:22 pm

Howdy, long time reader, first time poster upper.

I designed a custom board based off the at91sam9x25-ek, using the SAM9x25 Processor. The board has been schematicized , laid out, and manufactured: i.e., im holding it in my hand.

The problem I am having is talking to it. I can not get SAM-BA to talk to it using the predefined board profiles, but I was able to use J-LINK commander to pull out the ID, read registers, and other things through JTAG.

The first thing I would like to do is make a program to run board diagnostic, blink some LED's etc. However, I havent really found a straight forward tutorial for this. Ive seen all the bits and pieces but I am having trouble putting it all together to get some code on the board. I am familiar with uProcessors, but the external memory concept is new to me.

Most of the examples I have seen involve a board that already has some sort of low level init code running, but I cant find any examples of how to do my own low level init. Any help of my next steps?

TL;DR
-Made a Board, based off sam9x25-ek
-Cant get SAM-BA to talk to it
-Jlink commander can read some info from the chip (at 4mhz)
-How do I put some low level init code on the board

Thanks!
CptTitanic
Posts: 877
Joined: Sat Oct 30, 2010 6:04 pm

Re: Starting a Board From Bare Metal, Need Low level Init He

Fri Nov 22, 2013 10:24 pm

Round here we use Keil, it has debugger scripts (defining register writes, etc) to bring up code in SRAM, SDRAM on bare metal systems injecting code via JTAG. So the scripts are in INI files, select by Project Target, and scatter files via a GUI describing the memory regions the linker builds code too.

C:\Keil471a\ARM\Boards\Atmel\AT91SAM9X5-EK\ATSAM9G25\Blinky\Blinky.c

Download a eval version of uVision 4.7x, should be in there.

I could do similar with GNU/GCC and linker scripts, and injecting/executing code via a JLink console.

For register level exposition of the part, refer to technical reference manual.

Certainly going back to 9260-EK boards ATMEL had a download for the board, with libraries, examples and a "Getting Started" application. Had instruction to inject code to SDRAM using SAM-BA, and executing it. Should be compilable at different location of SRAM, and injectable with JLink. Might also be able to manually, or script, writing of control registers to bring up SDRAM too.
jumbo013
Posts: 2
Joined: Fri Nov 22, 2013 9:07 pm

Re: Starting a Board From Bare Metal, Need Low level Init He

Mon Dec 09, 2013 11:10 pm

Ok, so I got Keil, version 4.73 installed like you said.
Im using a sam-ice Debugger.
After some fiddling, I can talk to the board, sort of, but keil keeps freezing up on debugging, and some of the information is coming back odd (or I dont know if I am reading it right). This is a completely blank chip. Here is what I got going on.

I can set up J-Link commander, connect, and I get this:

Code: Select all

SEGGER J-Link Commander V4.78h ('?' for help)
Compiled Nov 19 2013 21:34:40
DLL version V4.78h, compiled Nov 19 2013 21:34:25
Firmware: J-Link ARM V8 compiled Nov  8 2013 12:07:30
Hardware: V8.00
S/N: 28016228
OEM: SAM-ICE
Feature(s): RDI, GDB
VTarget = 3.293V
Info: TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
Info: TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
No devices found on JTAG chain. Trying to find device on SWD.
No device found on SWD.
Did not find any core.
Failed to identify target. Trying again with slow (4 kHz) speed.
Info: TotalIRLen = 4, IRPrint = 0x01
Info: CP15.0.0: 0x41069265: ARM, Architecure 5TEJ
Info: CP15.0.1: 0x1D152152: ICache: 16kB (4*128*32), DCache: 16kB (4*128*32)
Info: Cache type: Separate, Write-back, Format C (WT supported)
Found 1 JTAG device, Total IRLen = 4:
 #0 Id: 0x0792603F, IRLen: 04, IRPrint: 0x1, ARM926EJ-S Core (Atmel)
Found ARM with core Id 0x0792603F (ARM9)

Code: Select all

J-Link>hwinfo
HWInfo[00] = Target power is disabled
HWInfo[02] = 3mA        (ITarget)
HWInfo[03] = 3mA        (ITargetPeak)
HWInfo[04] = 3mA        (ITargetPeakOperation)
HWInfo[10] = 0ms        (ITargetMaxTime0)
HWInfo[11] = 0ms        (ITargetMaxTime1)
HWInfo[12] = 0ms        (ITargetMaxTime2)
HWInfo[13] = 0x00000000
HWInfo[27] = 0x00000003
HWInfo[28] = 0x00000003
J-Link>

Code: Select all

J-Link>st
VTarget=3.293V
ITarget=3mA
TCK=1 TDI=0 TDO=0 TMS=0 TRES=1 TRST=1
Supported target interface speeds:
 - 48 MHz/n, (n>=4). => 12000kHz, 9600kHz, 8000kHz, ...
 - Adaptive clocking
I also tried using J-Flash to poke around, and it can read the ID but thats as far as I can get.

I want to start testing my board, making sure memory is attached right, blink some lights, etc, but keil freezes up every time I enter in debug mode. (The Sam-ICE led goes dead until I turn the power off from the target, and then it behaves fine, seems like its waiting for something.)

Anyways, is there some initial setup I am missing? Having a censored of a time getting this to work.

Thanks in advance
bestboy4
Posts: 7
Joined: Fri Jan 16, 2015 6:53 pm

Re: Starting a Board From Bare Metal, Need Low level Init He

Mon Jan 26, 2015 5:06 pm

Bump

I am a newbie, and in the same predicament for a custom SAMA5D36 board.  I need a "how-to" on initiating a virgin board.  Maybe a blinky program would be helpful.  Any links to tutorials would be helpful.
blue_z
Location: USA
Posts: 1560
Joined: Thu Apr 19, 2007 10:15 pm

Re: Starting a Board From Bare Metal, Need Low level Init He

Mon Jan 26, 2015 10:55 pm

bestboy4 wrote:I am a newbie, and in the same predicament for a custom SAMA5D36 board.
That's not a good combination.
To what extent has the hardware functionality of this custom board been checked out?
bestboy4 wrote:I need a "how-to" on initiating a virgin board.  Maybe a blinky program would be helpful.
http://www.atmel.com/tools/SAMA5D3SOFTWAREPACKAGE.aspx

Regards

Return to “SAM-BA”

Who is online

Users browsing this forum: No registered users and 1 guest