Atmel START/XMEGA32E5/USART

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

Greets Freaks,

 

I used Atmel START to set up an example project for USART C and START defaults PC6 and PC7 for the USART RXD and TXD pins.

 

I set everything up, Interrupts, baud rates, interrupt enables etc, and program the part(real hardware).  When a byte comes in on the RXD pin, it is echoed out the TXD pin. 

 

Except

 

It does not.  The ISR never fires(I have an LED toggle each time the ISR fires and it stays quiet).

I checked my wiring - STK600 - All checks out.

I checked the connection to my terminal - All ok, I can loopback by jumping the TX/RX pins on the STK600

 

What the heck can it be?

 

I tried something that I remembered vaguely - Use PC2 and PC3 instead of PC7 and PC6.

 

IT WORKS!!  What the heck?

 

I checked the driver_init.c file and it sets the pins the same:

void USART_0_initialization(void)
{

	// Set pin direction to input
	PC6_set_dir(PORT_DIR_IN);

	PC6_set_output_pull_mode(
	    // <y> Output and Pull Configuration
	    // <id> pad_output_pull_config
	    // <PORT_CONFIGURATION_TOTEM"> Totem-pole
	    // <PORT_CONFIGURATION_BUSKEEPER"> Totem-pole with bus-keeper
	    // <PORT_CONFIGURATION_PULLDOWN"> Pull-down
	    // <PORT_CONFIGURATION_PULLUP"> Pull-up
	    // <PORT_CONFIGURATION_WIREDOR"> Wired-OR
	    // <PORT_CONFIGURATION_WIREDAND"> Wired-AND
	    // <PORT_CONFIGURATION_WIREDORPULL"> Wired-OR with pull-down
	    // <PORT_CONFIGURATION_WIREDANDPULL"> Wired-AND with pull-up
	    PORT_CONFIGURATION_TOTEM);

	// Set pin direction to output
	PC7_set_dir(PORT_DIR_OUT);

	PC7_set_level(
	    // <y> Initial level
	    // <id> pad_initial_level
	    // <false"> Low
	    // <true"> High
	    false);

	USART_0_init();
}

or

void USART_0_initialization(void)
{

	// Set pin direction to input
	PC2_set_dir(PORT_DIR_IN);

	PC2_set_output_pull_mode(
	    // <y> Output and Pull Configuration
	    // <id> pad_output_pull_config
	    // <PORT_CONFIGURATION_TOTEM"> Totem-pole
	    // <PORT_CONFIGURATION_BUSKEEPER"> Totem-pole with bus-keeper
	    // <PORT_CONFIGURATION_PULLDOWN"> Pull-down
	    // <PORT_CONFIGURATION_PULLUP"> Pull-up
	    // <PORT_CONFIGURATION_WIREDOR"> Wired-OR
	    // <PORT_CONFIGURATION_WIREDAND"> Wired-AND
	    // <PORT_CONFIGURATION_WIREDORPULL"> Wired-OR with pull-down
	    // <PORT_CONFIGURATION_WIREDANDPULL"> Wired-AND with pull-up
	    PORT_CONFIGURATION_TOTEM);

	// Set pin direction to output
	PC3_set_dir(PORT_DIR_OUT);

	PC3_set_level(
	    // <y> Initial level
	    // <id> pad_initial_level
	    // <false"> Low
	    // <true"> High
	    false);

	USART_0_init();
}

 

So why does the USART comms NOT work with Atmel START defaults and it DOES work when I go and change the pins to the alternate?

 

Hmmmm.....The Datasheet for the E5 family seems to contradict START altogether:

 

I read the above as Pins 3:0 are the default, and Pins 7:4 are the alternate, but that does not explain why the START default does not work.  I am sifting through the files START generates to find the remap but so far no luck.

 

If anyone can shed light on this I would really appreciate it.

 

Thanks

Jim

 

EDIT:

I can not find any mention of REMAP in the files in either way the project is configured...PC6:7 or PC2:3.

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

Last Edited: Sun. Apr 21, 2019 - 04:03 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just some more research to share:

 

I opened up Codevision and set up the same project.  CV defaults to PC2 and PC3 and has the REMAP set as follows:

// PORTC Peripheral Output Remapping
// OC4A Output: Pin 0
// OC4B Output: Pin 1
// OC4C Output: Pin 2
// OC4D Output: Pin 3
// USART0 XCK: Pin 1
// USART0 RXD: Pin 2
// USART0 TXD: Pin 3
PORTC.REMAP=(0<<PORT_USART0_bp) | (0<<PORT_TC4D_bp) | (0<<PORT_TC4C_bp) | (0<<PORT_TC4B_bp) | (0<<PORT_TC4A_bp);

 

Now if I set the USART to PC 6 and PC7 the remap shows:

// PORTC Peripheral Output Remapping
// OC4A Output: Pin 0
// OC4B Output: Pin 1
// OC4C Output: Pin 2
// OC4D Output: Pin 3
// USART0 XCK: Pin 5
// USART0 RXD: Pin 6
// USART0 TXD: Pin 7
PORTC.REMAP=(1<<PORT_USART0_bp) | (0<<PORT_TC4D_bp) | (0<<PORT_TC4C_bp) | (0<<PORT_TC4B_bp) | (0<<PORT_TC4A_bp);

Which follows what the datasheet states:

 

This leads me to believe that there is a bug in START for this driver.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

This leads me to believe that there is a bug in START for this driver.

I'm shocked!! surprise That's why I used assembler for my E5 project/product, so much easier.  devil

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

I know John, I struggled to accept it as well, but appears to be true. I use assemblers to put the product together, don't think they are able to,program....maybe the assemblers in Oz are better equipped. Dunno

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user