Problem with simple blinking LED project

Go To Last Post
19 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello everyone!

 

I'm making the move from AVR projects to SAM projects and the process is obviously a lot different.  I'm not a fan of the ASF's as I like to work more from a baremetal/register based approach rather than a library approach. 

 

Anyway, I took an existing SAME70 project (I have the XPLD board for it, which is what I'm working with), in this case the "IOPORT_EXAMPLE3" project then sorted through the ASF to determine how the registers are actually being setup and created a project.  In this case, the IOPORT_EXAMPLE3 project just reads the status of the switch and writes it to the LED.  SHOULD be very straight forward but it's not working for me, so I clearly have done something wrong!

 

Below is my main file:

#include "sam.h"
#include "..\Header\AppInit.h"

#define LED0_GPIO	(PIO_PC8_IDX)
#define SW_GPIO		(PIO_PA11_IDX)


int main(void)
{
    /* Initialize the SAM system */
    //SystemInit();
	ClockInit();
	GPIOInit();
	
    /* Replace with your application code */
    while (1) 
    {
		/* If Switch is high */
		if((PIOC->PIO_PDSR & 0x800)!=0)
		{
			/* Set LED high */
			PIOC->PIO_SODR=PIO_SODR_P8;
		}
		else
		{
			/* Set LED low */
			PIOC->PIO_CODR=PIO_CODR_P8;
		}
    }
}

 

Here is my GPIO setup:

 

void GPIOInit(void)
{
	/* Disable watchdog (for now) */
	WDT->WDT_MR=WDT_MR_WDDIS;
	
	/*Configure PORTC.Pin8 as output (LED)*/
	PIOC->PIO_OER=PIO_OER_P8;
	
	/* Need to set A11 as input */
	PIOA->PIO_ODR=PIO_ODR_P11;

	/* Enable Pullup */
	PIOA->PIO_PUER=PIO_PUER_P11;

}

It's clearly not a complicated project (unless it's a clock based issue, which is entirely possible.  I'm uploading my whole project just in case) but it's not currently working for me.  When debugging, it appears to go into the "Set LED low" loop once and then stops hitting my breakpoints, which is odd.  It also doesn't seem to want to let me evaluate the PDSR register, which makes it difficult to debug:

 

 

I'm guessing the issue is with my "IF" statement in main but I can't quite see what I'm doing wrong.  I'm sure it's probably a really dumb problem but I'm having trouble seeing it right now.  I thought it might be worth popping in here and seeing if someone with more experience can point me in the right direction.  Thanks!

Attachment(s): 

This topic has a solution.

Last Edited: Mon. Jul 9, 2018 - 04:24 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

At least for the watch, you need to watch the instance, PIOC->PIO_PDSR or use the IO View to list all registered in PIOC
.
If you don't hit anything, what happens if you pause?

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's kind of the weird thing.  If I pause it, it'll either be on the if statement or the set LED low statement.  So it's probably doing the same thing over and over again but it's not treating it like that from a breakpoint perspective.  If it helps, I can take a video of it and load it to youtube!  Let me know if that helps.

 

As far as the watching the instance, I was able to right click on PIOC, navigate to PDSR and add the watch that way.  Still a bit confused as to why adding it the other way didn't work but I can accept that's just the way it is and move on.  It does appear to be showing up as zero, regardless of whether or not I'm holding the button.  This leads me to believe one of a few options:

 

1) I'm not masking it correctly

2) I have the wrong port/pin

3) I'm not checking it right

 

I double checked it and it appears it's connected to PA11:

 

 

Using that logic, it should be masked with PDSR and 0b1000 0000 0000 = 0x800, so I think I have that correct:

 

 

Not sure what else I could be missing.  Let me know if there's anything else I can do or provide to to test other causes.  Thanks for all your help @meolsen!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm not familiar with the E70, but some ARMs will "fault" on access to peripherals that haven't been enabled properly (clocks, etc), and then "hard fault" when there's no valid fault handler.  Debuggers can act "mysteriously" under such circumstances...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, I was still having some issues getting those breakpoints to work so someone in another thread suggested adding a "NOP" command to get the breakpoints to fire (I guess it's an issue with inline macros but doesn't really explain to me why I'm seeing those issues just accessing the registers).  Below is what my code now looks like:

 

#include "sam.h"
#include "..\Header\AppInit.h"

#define LED0_GPIO	(PIO_PC8_IDX)
#define SW_GPIO		(PIO_PA11_IDX)

#define _NOP() do { __asm__ __volatile__ ("nop"); } while (0)

int main(void)
{
    /* Initialize the SAM system */
    //SystemInit();
	ClockInit();
	GPIOInit();
	
    /* Replace with your application code */
    while (1) 
    {
		/* If Switch is high */
		_NOP();
		if((PIOC->PIO_PDSR & 0x0800)!=0)
		{
			/* Set LED high */
			_NOP();
			PIOC->PIO_SODR=PIO_SODR_P8;
		}
		else
		{
			/* Set LED low */
			_NOP();
			PIOC->PIO_CODR=PIO_CODR_P8;
		}
    }
}

What I can see is that it goes straight from the if statement (which always reads the value 0 from the PDSR) to setting the LEDs low. 

 

Is it possible my pullups are enabled and that's the reason it can't differentiate the button is pressed or unpressed?  I think I set that up correctly but maybe not?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

From the datasheet:

Writing any of the registers of the user interface does not require the peripheral clock to be enabled. This means that the configuration of the I/O lines does not require the peripheral clock to be enabled.

However, when the clock is disabled, not all of the features of the PIO Controller are available, including glitch filtering. Note that the input change interrupt, the interrupt modes on a programmable event and the read of the pin level require the clock to be validated.

After a hardware reset, the peripheral clock is disabled by default.

Reading the I/O line levels requires the clock of the PIO Controller to be enabled, otherwise PIO_PDSR reads the levels present on the I/O line at the time the clock was disabled.

 

I think you need code that manipulates the PMC.  In an actual ASF project, that would have been calls to sysclk_enable_peripheral_clock() call via (board_init/ioport_init/arch_ioport_init/...

 

Um, something like:

  PMC->PMC_PCER0 = (1<<ID_PIOA) + (1<<ID_PIOC);

 

Last Edited: Wed. Jul 4, 2018 - 08:00 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I went ahead and added your suggestion into my code:

 

/* Enable peripheral clock - Added 07-04-18 */
    reg = PMC->PMC_WPMR;                                    // Store existing PMC_WPMR register into reg
    reg|= PMC_WPMR_WPKEY_PASSWD;                            // Required for write access
    reg &= ~PMC_WPMR_WPEN_Msk;                                // Clear write protect enable
    PMC->PMC_WPMR = reg;                                    // Sets reg value into PMC_WPMR register
    
    reg = PMC->PMC_PCER0;                                    // Store existing PMC_PCER0 register into reg
    //reg |= PMC_PCER0_PID10_Msk;                                // Enables peripheral clock on PID10 (PIOA)
    reg |= 0x200;                                            // Enables peripheral clock on PID10 (PIOA)
    PMC->PMC_PCER0 = reg;                                    // Sets reg value into PMC_PCER0 register

 

Unfortunately, it didn't work (which, honestly, kind of makes sense as I don't currently have a peripheral clock setup.  I only have a main clock).  Below is my main clock code:

 

void ClockInit(void)
{
	/*
	   NOTE: should probably disable interrupts, but since this should only execute at startup, not doing that now.
	   If power/crystal management is enabled then this function would need to be updated to ensure that 
	   interrupts won't occur during clock changeover
	*/
	uint32_t regValue=0;
	volatile uint32_t atomic = __get_PRIMASK();
	__disable_irq();
	__DMB();
	 
	/* First enable the crystal oscillator */
	uint32_t reg=PMC->CKGR_MOR&~CKGR_MOR_MOSCXTBY_Msk;		//Clear MOSCXTBY (required to enable main crystal oscillator)
	reg|=CKGR_MOR_KEY_PASSWD;								// Required for write access
	reg|=CKGR_MOR_MOSCXTEN;									// Enable main oscillator
	
	/* need to configure a startup time for crystal (8*SLCK cycles)  range 0-FF */
	reg|=CKGR_MOR_MOSCXTST(62);								// Startup time = 62 x 8 = 492 clock cycles for main crystal osccilator
	PMC->CKGR_MOR=reg;										// Sets reg value into CKGR_MOR register
	
	/* Step 2: Wait for crystal to start up */
	while((PMC->PMC_SR&PMC_SR_MOSCXTS_Msk)==0)
	{
		/* loop on crystal stabilizing */
	}

	/* Step 3: Now switch clock source to crystal */
	reg=PMC->CKGR_MOR;										// Store existing CKGR_MOR register into reg
	reg|=CKGR_MOR_KEY_PASSWD;								// Required for write access
	reg|=CKGR_MOR_MOSCSEL_Msk;								// Select main crystal oscillator
	PMC->CKGR_MOR=reg;										// Sets reg value into CKGR_MOR register
	/* Step 4: Wait for clock to switch */
	while((PMC->PMC_SR&PMC_SR_MOSCSELS_Msk)==0)
	{
		/* loop on clock source switching */
	}

	/* Step 5: Now we should be running off the crystal, check frequency before setting PLL */
	do
	{
		reg=PMC->CKGR_MCFR;
	}while((reg&CKGR_MCFR_MAINFRDY_Msk)==0);
	reg=PMC->CKGR_MCFR&CKGR_MCFR_MAINF_Msk;
	__DSB();
	__ISB();
	
	regValue=reg;/* Store for debug curiosity */

	if(reg==0)
	{
		/* Failed to lock on frequency or didn't enable/switch to crystal correctly, revert to RC osc */
		reg=PMC->CKGR_MOR;									// Store existing CKGR_MOR register into reg
		reg|=CKGR_MOR_KEY_PASSWD;							// Required for write access
		reg&=~(CKGR_MOR_MOSCSEL_Msk);						// Select main RC oscillator
		PMC->CKGR_MOR=reg;									// Sets reg value into CKGR_MOR register
		while(1) {/* Only for debug*/
		}
	}
	else
	{
		/* Step 6: Clock source switched to crystal, now configure the PLL */
		/* First write 0 to MULA to disable PLL */
		reg = PMC->CKGR_PLLAR;								// Store existing CKGR_PLLAR register into reg
		reg &= ~CKGR_PLLAR_MULA_Msk;						// Disable PLL
		reg |= CKGR_PLLAR_MULA(0);							// Disable PLL
		PMC->CKGR_PLLAR = reg;
		/* Assume 12MHz crystal, want 300MHz out, so need (24+1) mult */
		/* Broken out 06-28-18 */
		//reg=CKGR_PLLAR_ONE_Msk|(CKGR_PLLAR_MULA(24))|(CKGR_PLLAR_PLLACOUNT(0x3F))|(CKGR_PLLAR_DIVA(CKGR_PLLAR_DIVA_BYPASS_Val));
		reg = CKGR_PLLAR_ONE_Msk;							// Bit must be set for programming
		reg |= CKGR_PLLAR_MULA(24);							// PLLA frequency = 8MHz * (24 + 1) = = 300 MHz
		reg |= CKGR_PLLAR_PLLACOUNT(0x3F);					// LOCKA bit is set in PMC_SR 63 clock cycles after CKGR_PLLAR is written
		reg |= CKGR_PLLAR_DIVA(CKGR_PLLAR_DIVA_BYPASS_Val);	// Divider is bypassed (divide by 1) and PLLA is enabled
		
		/* Assume 12MHz crystal, x10 --> 120 MHz */
		/*reg=CKGR_PLLAR_ONE_Msk|(CKGR_PLLAR_MULA(9))|(CKGR_PLLAR_PLLACOUNT(0x3F))|(CKGR_PLLAR_DIVA(CKGR_PLLAR_DIVA_BYPASS_Val));*/
		PMC->CKGR_PLLAR=reg;								// Sets reg value into CKGR_PLLAR register


		/* Now wait for lock bit in status register */
		while((PMC->PMC_SR&PMC_SR_LOCKA_Msk)==0)
		{
			/* Wait for lock to set*/
		}

		/* Step 7: Now select main clock to PLLA output */
		/*  Need to do in three steps, waiting for the MCKRDY bit between each step */
		/* First off, set the prescaler */
		reg = PMC->PMC_MCKR;								// Store existing CKGR_MCKR register into reg
		reg &= ~PMC_MCKR_PRES_Msk;							// Clear processor prescaler register
		reg |= PMC_MCKR_PRES(PMC_MCKR_PRES_CLK_1_Val);		// Set processor prescaler to 1
		PMC->PMC_MCKR=reg;									// Sets reg value into PMC_MCKR register
		
		/* Now wait for master clock ready bit in status register */
		while((PMC->PMC_SR&PMC_SR_MCKRDY_Msk)==0)
		{
			/* Wait until master clock is ready */
		}
		
		/* Next, set the MDIV */
		reg = PMC->PMC_MCKR;								// Store existing CKGR_MCKR register into reg
		reg &= ~PMC_MCKR_MDIV_Msk;							// Clear master clock divider register
		reg |= PMC_MCKR_MDIV(PMC_MCKR_MDIV_PCK_DIV2_Val);	// Master clock is set to FCLK divided by 2 (150 MHz)
		PMC->PMC_MCKR = reg;								// Sets reg value into PMC_MCKR register
		/* Now wait for master clock ready bit in status register */
		while((PMC->PMC_SR&PMC_SR_MCKRDY_Msk)==0)
		{
			/* Wait until master clock is ready */
		}
		
		/* Finally, set the clock source selection */
		reg = PMC->PMC_MCKR;								// Store existing CKGR_MCKR register into reg
		reg &= ~PMC_MCKR_CSS_Msk;							// Clear master clock source selection register
		reg |= PMC_MCKR_CSS(PMC_MCKR_CSS_PLLA_CLK_Val);		// Set master clock to PLLA clock
		PMC->PMC_MCKR = reg;								// Sets reg value into PMC_MCKR register
		while((PMC->PMC_SR&PMC_SR_MCKRDY_Msk)==0)
		{
			/* Wait until master clock is ready */
		}
	}
	
	/* Enable peripheral clock - Added 07-04-18 */
	reg = PMC->PMC_WPMR;									// Store existing PMC_WPMR register into reg
	reg|= PMC_WPMR_WPKEY_PASSWD;							// Required for write access
	reg &= ~PMC_WPMR_WPEN_Msk;								// Clear write protect enable
	PMC->PMC_WPMR = reg;									// Sets reg value into PMC_WPMR register
	
	reg = PMC->PMC_PCER0;									// Store existing PMC_PCER0 register into reg
	//reg |= PMC_PCER0_PID10_Msk;								// Enables peripheral clock on PID10 (PIOA)
	reg |= 0x200;											// Enables peripheral clock on PID10 (PIOA)
	PMC->PMC_PCER0 = reg;									// Sets reg value into PMC_PCER0 register
	
__DSB();
__ISB();
__DMB();
__set_PRIMASK(atomic);
}

I did open up the existing sample project though, I found where the PCER0 is being set and it's in a macro called "pmc_enable_all_periph_clk" but this function is never called.  It doesn't appear that a peripheral clock is needed to run the example project so I'm guessing this isn't the problem and just having a main clock is fine. 

 

Any other ideas?  I must be missing something simple but I can't seem to see it.  Thanks for all your help!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh, another oddity worth mentioning, when I burn the code in the device programming menu, the LED is off.  When I click on "start debugging", the LED is on.  Not entirely sure why I'd get two different behaviors from two different methods.  It's really odd . . .

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
	reg = PMC->PMC_PCER0;									// Store existing PMC_PCER0 register into reg
	//reg |= PMC_PCER0_PID10_Msk;								// Enables peripheral clock on PID10 (PIOA)
	reg |= 0x200;											// Enables peripheral clock on PID10 (PIOA)
	PMC->PMC_PCER0 = reg;									// Sets reg value into PMC_PCER0 register

PCER0 is a "write-only" register; I'm not sure what will happen here...

Didn't you say the LED was on PIOC - better enable that too.

The datasheet says the PCER0/1 PCDR0/1 registers "enable or disable" the peripheral clocks, but PCR can CONFIGURE the peripheral clocks.  With bits that "must be correctly set" but don't seem to be described anywhere :-(

I don't know what the Peripheral clock "default" configuration is.  I can't find ANY use of PMC_PCR in the example program.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, I made some sort of progress.  I took my main.c loop code and put it into the example project to see if it worked and, of course it didn't, which showed me there was something wrong with that section.  Then I noticed I had either a copy/paste error or just a quick oversight error.  Anyway, I changed my if statement from:

 

if((PIOC->PIO_PDSR & 0x0800)!=0)

To

 

if((PIOA->PIO_PDSR & 0x0800)!=0)

Since the LED is on PortC but the button is on PortA.  This got it working in the example project with my loop code (which is a good step forward). 

 

Unfortunately, I then made the same changes in my project and it failed, so I either have an issue with the way I'm establishing my GPIO (very possible and probably the easiest solution) or I have something wrong with my clock (which is going to likely be much more difficult to solve). 

 

Thanks for all your help, westfw!  Hopefully, I can get this up and working soon!  I'm a little surprised a simple read of an input pin would be such an issue . . .

 

I don't suppose there's a SAM/bare metal tutorial like there is for the AVR chips in the AVR forum, is there?  I looked in here but didn't see anything. 

 

Thanks again!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I guess the core of the issue has to do with being able to read the switch data though, right?  It doesn't look like it's having any issues writing to the LED.  It must be some clock or register that I'm not setting up correctly to be able to read the LEDs. 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't suppose there's a SAM/bare metal tutorial

 I have one for SAMD11: https://github.com/WestfW/SAMD10... (One of the reasons that I'm interested.)

Alas, the Atmel SAM processors have annoying inconsistencies between the different families, ESPECIALLY when it comes to clock initialization and which peripherals require what sort of enable code...

 

Alex Taradov has gotten further than I have, and has starter projects for quite a few SAM families (hah!  Including SAME70!)

https://github.com/ataradov

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah, I agree with you 100% on the SAM clock setups.  I have a presentation Atmel gave me on getting started with baremetal C on the D20 chips and it was pretty easy to understand, easy to sort through . . . now going to the E70, the clock setup is probably very versatile but it's kind of a nightmare for a startup project.  Makes me understand why people use Atmel Start and ASF projects.  I'm half tempted to include the ASF, setup the clock with the ASF and do the remainder of the project baremetal (for simplicity sake). 

 

I did checkout Alex's startup project for the E70 and it looks like a pretty good starting point!  might be able to inject a few things into my project and get it up and working (i'll let you know if I figure out the solution to that one.  it's probably some sort of issue related to the read pin functionality). 

 

One thing I was confused by (when trying to recreate his project) is the HAL file.  It has a bunch of "\" in the file (which I don't really understand and I don't fully understand the ##name## functions (in fact, I'm getting compilation errors with it).  Maybe I have something setup wrong.  Is there something similar in the D11 project? 

 

Thanks again for your help!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, I ended up just taking the clock init portion of the code (which, admittedly, has some port setup stuff in it) and putting it into my project and it seems to work.  This is what I used (from Alex's files):

 

void ClockInit(void)
{
	// Disable watchdog
	WDT->WDT_MR = WDT_MR_WDDIS;

	// Set flash wait states to maximum for 150 MHz operation
	EFC->EEFC_FMR = EEFC_FMR_FWS(5) | EEFC_FMR_CLOE;

	// Enable 12 MHz Xtal
	PMC->CKGR_MOR = CKGR_MOR_KEY_PASSWD | CKGR_MOR_MOSCXTST(8) |
	CKGR_MOR_MOSCRCEN | CKGR_MOR_MOSCXTEN;
	while (!(PMC->PMC_SR & PMC_SR_MOSCXTS));
	
	PMC->CKGR_MOR = CKGR_MOR_KEY_PASSWD | CKGR_MOR_MOSCXTST(8) |
	CKGR_MOR_MOSCRCEN | CKGR_MOR_MOSCXTEN | CKGR_MOR_MOSCSEL;
	while (!(PMC->PMC_SR & PMC_SR_MOSCSELS));

	// Setup PLL (12 MHz * 25 = 300 MHz)
	PMC->CKGR_PLLAR = CKGR_PLLAR_ONE | CKGR_PLLAR_MULA(25-1) |
	CKGR_PLLAR_PLLACOUNT(0x3f) | CKGR_PLLAR_DIVA(1);
	while (!(PMC->PMC_SR & PMC_SR_LOCKA));

	// Switch main clock to PLL (two step process)
	PMC->PMC_MCKR = PMC_MCKR_CSS_MAIN_CLK | PMC_MCKR_MDIV_PCK_DIV2;
	while (!(PMC->PMC_SR & PMC_SR_MCKRDY));

	PMC->PMC_MCKR = PMC_MCKR_CSS_PLLA_CLK | PMC_MCKR_MDIV_PCK_DIV2;
	while (!(PMC->PMC_SR & PMC_SR_MCKRDY));

	// Enable PIOA, PIOB, PIOC, PIOD and PIOE
	PMC->PMC_PCER0 = PMC_PCER0_PID10 | PMC_PCER0_PID11 | PMC_PCER0_PID12 |
	PMC_PCER0_PID16 | PMC_PCER0_PID17;

	// Disable altenate functions on some pins
	MATRIX->CCFG_SYSIO |= CCFG_SYSIO_SYSIO4;
}

It does appear to have used the PCER0 registers, same as you suggested.  After using this, my program works.  I ended up going back to my initial clock setup and adding just the PCER0 and disabling alternate functions to my current code to see if that was it but that didn't appear to work so there's something else that might be an issue. 

 

I'm going to go back line by line and isolate the issue and I'll try and report back from here.  The important thing is it's now working.  Now I just need to fill in the knowledge gaps to be able to understand exactly what I missed. 

 

Thanks for all your help and, hopefully, you have things resolved on your project too.  Good luck!  I'll report back what I find!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
/*- Definitions -------------------------------------------------------------*/
#define HAL_GPIO_PIN(name, port, pin)						\
  static inline void HAL_GPIO_##name##_set(void)				\
  {										\
    PIO##port->PIO_SODR = (1 << pin);						\
    (void)HAL_GPIO_##name##_set;						\
  }										\
										\
  static inline void HAL_GPIO_##name##_clr(void)				\
  {										\
    PIO##port->PIO_CODR = (1 << pin);						\
    (void)HAL_GPIO_##name##_clr;						\
} \

## is token concatenation ( https://en.wikipedia.org/wiki/C_... )  "HAL_GPIO_PIN(myLED, A, 12)" will go and define a bunch of (static inline) functions like:

static inline void HAL_GPIO_myLED_set(void) {
   PIOA->PIO_SODR = (1<<12);
}

Note that it's a BIG macro and the "\" at the end of each line is a "line continuation" character.  Bad things will happen if you partially copy it, or add trailing spaces, or various other things.

I was able to compiler Alex's E70 example with no changes and no errors...

 

 

(This is a very different style of abstraction than that provided by ASF, or Arduino.   In a lot of ways, it's much better - it lets the compiler do a lot more optimization.   But C macros are ... annoying and hard to read.  What I really wish is that C had a 'real' macro capability, instead of the ugly and rather poorly defined string substitution nonsense that it has.  Most assembler from that era had really power macro capabilities; I wonder why no HLL seems to have followed in those footsteps.)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Stupid question, how were you able to check the whole project out?  I'm not all that familiar with Github so I ended up creating a new project from scratch and adding the 3 *.c files.  Worked well for the most part with a few minor changes (such as adding in #include "sam.h", etc). 

 

I figured it did something along those lines but I couldn't make it work in my code (I'm probably missing some #include statement that gave it that ability.  Just failed when I tried to copy and paste it all in though). 

 

Thanks for your help again!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I downloaded the whole .zip file, uncompressed it, and found a .cproj file that made Atmel Studio happy in ...\same70\astudio\demo.cproj. (or maybe it was demo.atsln). I double-clicked and studio opened it...

(I had much less luck trying to compile it from the command line.)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

cradleinflames wrote:
how were you able to check the whole project out?  I'm not all that familiar with Github

Use the 'Clone or download' button - choose the 'Download ZIP' option:

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the information.  I kept looking for a download button on the E70 page and, apparently, you have to download it from the startup project page (as in the screenshot).  So I was just looking in the wrong place.  Thanks for the information!