SAM7 demo gets stuck in Cstartup_SAM7.c

nobody wrote on Tuesday, November 15, 2005:

I tried your RTOS on AT91SAMS64 board but it doesn’t work. I use the IAR Workbench v.4.30A (evaluation version) with RTOS v. 3.2.3. I put a breakpoint in the main() but program loops in the Cstartup_SAM7.c. Note that IAR’s demos are working correctly.

rtel wrote on Tuesday, November 15, 2005:

Not getting through the startup code is indicative of a hardware problem.

I had a support request from somebody recently with the same problem.  The startup sequence was getting stuck waiting for the PLL to lock I think.  The problem was traced to how the board was being powered.  When the board was powered through a powered USB hub the PLL did not work - when the board was powered directly it did.  Are you powering the board through a USB hub?  If so can you try removing the hub.

The file Cstartup_SAM7.c is an Atmel supplied file.  Is the version in the FreeRTOS download different from the versions used with the other IAR/Atmel demos?


nobody wrote on Wednesday, November 16, 2005:

Dear Sirs,

I tried to power the AT91SAMS64 EK directly, NOT from USB hub. But the demo doesn’t work again.
I sent you new files, there are some differences, I tried to use the new ones but the demo is still not working. Does anybody use IAR 4.30A WB with the ARM7_AT91SAM7S64_IAR?

ps: Note that I have the evaluation version of the WB

nobody wrote on Wednesday, November 16, 2005:

I have the kickstart verion, is this the version you mean.  Works fine for me.

baxsie wrote on Thursday, November 17, 2005:

I was the other one having trouble with the startup. Here is the thread.

I thought I had it solved, but now I am not sure. There is something that seems to be flaky under the   ICE. It seems to run every time if I disconnect the ICE and power cycle. But it usually hangs under the ICE.

I have got the IAR + uIP demo program to serve a page a couple of times, but not consistently. My current plan is to go back to the Atmel examples, then look carefully at the FreeRTOS port. Maybe strip absolutely everything out then add the features in slowly.

I also have a different ICE coming. I’ll have to see how that works.

rtel wrote on Thursday, November 17, 2005:

Can you please check the .mac file that comes with against the one supplied by Atmel.  Perhaps it has changed.

The .mac file contains a set of macros that execute at various times during the debug cycle.  There is one that executes prior to the code being downloaded, one immediately after, etc.

The .mac files that were originally provided with the development kit contained several problems that could result in the code executing correctly during the first download, but failing on subsequent downloads.  This was because the first time the code runs it sets up some peripherals, notably the timer for the RTOS tick.  The next time you download the code the macro file should set all the peripherals back to their default state - disabling the timer tick again prior to executing the code (along with some other things).  However this was not done and the tick kept ticking during the startup sequence causing problems.  There were other issues also, I can’t remember exactly but a search of this forum might turn them up.

If you:

1 Program the flash using the JTAG.
2 Power down the board.
3 Remove the JTAG adaptor.
4 Power up again.

and the demo always runs then it is most likely to be the macros that setup the debugger.

Hope this helps!  Please let us know if the .mac file supplied by Atmel now contains any changes.


nobody wrote on Thursday, November 17, 2005:

Yesterday I tried with version FreeRTOS 2.6.1 and IAR 4.11 (full version), to setup the test I need to port the example to 4.11 version,
it seems to be made with another version (which version? it looks to me really strange to have uncompatible project file from 4.11 to 4.30…)

The results are slightly better: I put a breakpoint in the main (on setup hardware function) and the program seems to reach it; But it’s still not working. I always use the workbench in debug mode.

I use a "IAR Jlink JTAG" interface to program the micro directly from IAR Workbench;

I will have a check on .mac file and I’ll try your 4 steps, then I will post the results.

nobody wrote on Thursday, November 17, 2005:

IAR did completely change format between versions (not sure which versions exactly).  It is not forward compatible which is a real pain.  It should be backward compatible though.

nobody wrote on Thursday, November 17, 2005:

We had similar problem. According to ATMEL’s ARM7 data sheet there is a warnings about a fast VDDCORE ramp of 6V/ms. It seems that if you not meet this requirement slow clock does not start and consequently chip doesn’t start at all.
Use some 3.3V power supply chip with shutdown controlled by a capacitor. It should switch VDDCORE fast.

nobody wrote on Friday, November 18, 2005:

The problem was really stupid: the jumper "erase TP4" was plugged in! I try the 4 combination of jumpers and I found that simply removing that jumper is enough.

Now my AT91SAM7S64’s DEMO is working!

ps: I’m really sorry for the noise!

rtel wrote on Tuesday, February 28, 2006:

I actually just experienced this myself with my new Laptop and new installation of IAR tools.

I found that adding a delay loop before and after setting up the divide by two clock in Cstartup_SAM7.c got around the problem.

Not sure about this but will include it in the FreeRTOS V4.0.0 download.