XMEGA LCD Controller won't display with my code.

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

I have an XMEGA-B1 Xplained board.  I am using an Atmel ICE in conjuction with Atmel Studio 7.  When I run the LCD_EXAMPLE1 it all works fine.

 

I have used ASF to put the LCD driver into another example program - the AT45DBX_UNIT_TESTS1  and copied the relevant initialisations and functions from LCD_EXAMPLE1 into it to try to get the LCD to display something.

 

I cannot get even one character to display.  Looking at the VLCD with an oscilloscope it doesn't get turned on. 

 

I have been going through my code looking for differences and can't see anything wrong.  

 

I have been looking at the LCD controller registers, Power Reduction register, Sleepmanager with the debugger and comparing the two projects.  I can't see anything wrong. 

 

I am very new to XMEGAs etc so I have heaps more to learn before I have exhausted all avenues so I am not asking anyone to debug my code.  It's just that I have spent so much time on this and would rather have moved on to the next step.

 

Anyone familiar with using the LCD controller able to tell me any gotchas/traps for newbies?  Thanks

 

 

This topic has a solution.
Last Edited: Fri. Jan 5, 2018 - 08:29 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

paul.gaastra wrote:
copied the relevant initialisations and functions from LCD_EXAMPLE1

IME, just copying stuff out of an ASF project is not sufficient.

 

You need to start with the ASF project, and copy your other stuff into it ...

 

paul.gaastra wrote:
I have been going through my code looking for differences and can't see anything wrong. 

Have you stepped through it in the debugger?

 

eg,

Looking at the VLCD with an oscilloscope it doesn't get turned on

So step through the working code, and see where it does get turned on.

 

Then step through the non-working code to see what's different/missing ...

 

 

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

awneil wrote:
IME, just copying stuff out of an ASF project is not sufficient.

 

You need to start with the ASF project, and copy your other stuff into it ...

+1  This method has always worked for me

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

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

awneil wrote:
So step through the working code, and see where it does get turned on.   Then step through the non-working code to see what's different/missing ...

 

Thanks for the suggestion.  That's what I have been doing but not methodically enough.

 

Doing that on the working code I see, in dissassembler, stuff that I have no idea why the compiler thought to put it in/how it got in there.  Something from ioport_compat.c.  I'm sure once I figure that out my problem will be solved.

 

Thanks heaps.

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

Something from ioport_compat.c.  I'm sure once I figure that out my problem will be solved.

 

Don't count on it...

Greg Muth

Portland, OR, US

Atmel Studio 7 (Version: 7.0.1652) on Windows 10

Xplained/Pro/Mini Boards mostly

 

 

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

paul.gaastra wrote:
Something from ioport_compat.c.

 

XMEGA legacy IOPORT software compatibility driver interface.

 

Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.

 

http://asf.atmel.com/docs/3.28.1/xmega.services.timeout.example1.xmega_a1_xplained/html/ioport__compat_8c.html

 

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

Sorry,

 

The assembler stuff came from two lines of C back from where I put the breakpoint.  I'll keep trying. 

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

Disclaimer:  I don't use ASF or C, but I'd think two places to look at carefully would be:

 

The I/O pin set up for the display.

Make sure each pin is being set up correctly, and that your code doesn't then in-set up the pin.

 

Look at your clock speed in the working and in the non-working code.

Make sure you aren't switching to a faster clock too soon, before some (perhaps relatively slow), start up times are being met.

 

JC

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

@DocJC said:

Make sure each pin is being set up correctly

 The XMEGA B family has a built-in LCD interface, so other than configuring that interface, there shouldn't be a need to setup individual pins on the LCD. 

Greg Muth

Portland, OR, US

Atmel Studio 7 (Version: 7.0.1652) on Windows 10

Xplained/Pro/Mini Boards mostly

 

 

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

Ah, good point.

I've used the A's and the E5, but never the B's.

 

JC

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

My only exposure to the B's is the same XMEGA-B1 Xplained board the OP has.  Here is its LCD:

 

 

 

 

Greg Muth

Portland, OR, US

Atmel Studio 7 (Version: 7.0.1652) on Windows 10

Xplained/Pro/Mini Boards mostly

 

 

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

A thousand apologies.

 

I have barely been able to work on this XMEGA stuff for a couple of days.

 

The LCD display working now.  I didn't have the clock settings correct.  Copying the settings from conf_clock.h in the working project into my project got the LCD working. 

 

Now I need to see what stuff I broke doing that.  

 

A lot of the suggestions above helped me to think more straight.  Thanks heaps.