SOLVED: Can't run simple start program on my own SAMS70 board

1 post / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SOLVED:  The problem was I did not bother to initialize the clock architecture when using START and apparantly the chip defaults to an external xtal which I do not have on my board since I use the internal RC.  If I were to guess I would say the code was waiting for the PLL to stabalize or something like that before preceeding to the Main() code.  Just a guess.  But in any case I'm now able to trace into Main().


I created a simple program using START (with no peripherals) for my SAME70 X Plained board and added the code below.  When I press the "start debugging and break" I can see the debug pointer situated at the start of the code and I can then just step through the simple code I wrote, so that's all good.  However  When I connect my own board which has a ATSAMS70Q21b chip and do a new START project with that chip selected and insert the same simple code in main.c, and press the Start Debugging and Break button, instead of stopping, the code just runs and never stops.  If I then pause the program, a disassembler window opens and if I then single step it seems the code is just running in an endless loop and I think that maybe its not even getting to the MAIN() routine.  It seems to be running something (I think) that is outside of the MAIN() and just never making it to main.  Does anyone know what's going on?  I did a hard erase on the chip using the erase pin, and tried several times but just can't get it to execute the code below.  I can put a breakpoint at the atmel_start_initi() line for example, and when I start the debugger it just never breaks. 


Also one more thing that could be helpful.  If I power cycle the board, then try and run the debugger, I get an error message that the debugger can't talk to the chip because it might be in a deep sleep mode or security pin set.  At this point, if I do a hard erase (erase pin), then I can once again run the debugger with the same problem as above.  So it seems from power up it goes into this endless loop or goes to sleep or something.  The addresses it loops around are 204000f4 (a few lines) and also 800102 or so.  Just keeps looping back and forth around these addresses.


#include <atmel_start.h>

int main(void)
    /* Initializes MCU, drivers and middleware */

    /* Replace with your application code */
    while (1) {
        for(int x=1; x<1000; x++){
            _gpio_set_pin_pull_mode(GPIO_PORTC,25, GPIO_PULL_DOWN); //set chip select low
            _gpio_set_pin_pull_mode(GPIO_PORTC,25, GPIO_PULL_UP); //set chip select hi

Last Edited: Mon. Jul 8, 2019 - 04:48 PM