Undefined Reference Error and Other Questions

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Undefined Reference Error and Other Questions

Postby Tectu » Mon Oct 29, 2012 12:43 am

Hello yellowtiger,

You don't have to check the SPI or UART output. When the LEDs light up right after the reset, and not only after a few minutes, everything is correct.
Simply copy that folder somewhere where you want to have your project and just edit it.
In case of you're interested: The problem must be that you didn't set the HSE properly and the MCU did only run on the LSI all the time.

I am not sure why gdispSetOrientation() should freeze your display. It works very well here. Please note that the display won't automatically flip all the content that has already been drawn on the screen. Changing the orientation only affects new drawing.
Please follow this guide: http://chibios-gfx.com/documentation/gdisp/usage/controls
The documentation is still in it's build up process and I can only do part by part. It's a very time consuming job, but I try my best to get everything ready as soon as possible ;-)


~ Tectu

yellowtiger
Posts: 15
Joined: Sun Oct 28, 2012 6:42 pm

Re: Undefined Reference Error and Other Questions

Postby yellowtiger » Mon Oct 29, 2012 2:02 am

Hi Tectu, thank for the reply. When I tried the example the LEDs light up right after the reset. So I guess everything is correct. I'll follow your advice and try to build new projects based on the example. I'll definitely google around on HSE and LSE. Thanks for your time and help!

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Undefined Reference Error and Other Questions

Postby Tectu » Mon Oct 29, 2012 7:14 am

Helllo yellowtiger,

HSE and LSI are different clock sources:

  • HSE = HighSpeedExternal
  • LSI = LowSpeedInternal

Right after the reset, your MCU does use an an internal clock source, the LSI to boot up. After boot up is complete, you mostly switch to an external clocksource, mostly a crystal which is way faster and more accurate. You configure these options in mcuconf.h and your board files.
If you are interested in this, you might wanna read the reference manual of your STM32F407 on your discovery board. It's well explained.

But anyways, even if you'd keep running on the LSI, this wouldn't have that result. I am pretty sure that you gave a wrong clock value somewhere. Please note that the speed values of your oscillators in the board files are in Hz, not MHz.


~ Tectu

Abhishek
Posts: 266
Joined: Wed May 23, 2012 3:15 pm
Location: India

Re: Undefined Reference Error and Other Questions

Postby Abhishek » Mon Oct 29, 2012 7:44 am

Hello yellowtiger,

yellowtiger wrote:Secondly, I noticed that every time I disconnect and reconnect the power to the STM32F4Discovery board, I have to wait for quite some time (~ 5min) and pressed the board reset button once for the graphics to show up on the LCD screen. Sometimes I have to power off and power on the STM32F4Discovery board a few times before anything shows up on the LCD screen. I'm confused why this happens. I don't think the board needs that long to initialize. So I was wondering if you guys could give me some comments/hints on how to troubleshoot the problem.


To me your problem looks more concerned with the hardware than the software. Looks like you need to increase FSMC bus delay. Assuming you as a first timer to MCUs, it is very likely that this is the source of your problem.

As for wiring, ensure that the wires are short and connections tight - try to solder the wires directly instead of using a breadboard (I don't know your setup, just assuming) A PCB is the best possible solution, though. The LCD bus is a very high speed bus, so long wires and loose contacts mess up the communication.

yellowtiger wrote:I used a 1k-ohm resistor between the LCD reset pin and the +3V MCU board pin.


You could do without the 1k resistor in series with the reset pin.

yellowtiger wrote:Lastly, could you recommend any good beginner books on MCU programming?

The MCU datasheet and reference manuals are the best books. :)

You will learn more MCU programming by doing and learning, and reading datasheets rather than flipping through a book. If you face problems, feel free to ask on the forum. Happy MCU-programming :) !

Cheers,
Abhishek

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Undefined Reference Error and Other Questions

Postby Tectu » Mon Oct 29, 2012 10:03 am

Afaik it's impossible to set FSMC timings so high. Also, this cannot be the problem since he didn't touch the display driver.

This must be a clcok initialization issue.


~ Tectu

User avatar
Badger
Posts: 346
Joined: Mon Apr 18, 2011 6:07 pm
Location: Bath, UK
Contact:

Re: Undefined Reference Error and Other Questions

Postby Badger » Mon Oct 29, 2012 11:16 am

Tectu wrote:Afaik it's impossible to set FSMC timings so high. Also, this cannot be the problem since he didn't touch the display driver.

I'd agree with that, 5 seconds would require the FSMC clock timings to be set very low, even with the biggest clock divider and highest delay I doubt you'd get any where near that. It could be that the LSE crystal is enabled and is taking ages to start up, or simply isn't there. If your LSE is enabled I'd try it disabled for now.

Abhishek
Posts: 266
Joined: Wed May 23, 2012 3:15 pm
Location: India

Re: Undefined Reference Error and Other Questions

Postby Abhishek » Mon Oct 29, 2012 12:07 pm

Clock can't be the issue because:

yellowtiger wrote:Hi Tectu, thank for the reply. When I tried the example the LEDs light up right after the reset. So I guess everything is correct.


If there was a problem with the clock tree, why are the LEDs blinking @ 1 Hz in the first place as soon as the board is reset, when example code is tried?

I still suspect wiring problems. Not that there cannot be other issues. [But when wiring problems, why waiting 5 minutes as said? - that's the question]. What drives me so is the fact that it works after a couple of resets, sometimes it works, sometimes it doesn't.

yellowtiger, I guess you are taking one of the F4Discovery demos of ChibiOS and then replacing the main.c file with the one in the demo, right [That is the way demos are to be run] ? Also since you are using F4Discovery with FSMC, some modification may be made - you should be aware of potential pin conflicts on board.

Maybe you could post a screenshot of your hardware setup,?

Best Regards
Abhishek

Abhishek
Posts: 266
Joined: Wed May 23, 2012 3:15 pm
Location: India

Re: Undefined Reference Error and Other Questions

Postby Abhishek » Mon Oct 29, 2012 12:35 pm

Just had a relook on the entire thread.

yellowtiger, from your posted code, I think you are already using the ChibiOS makefile and build system. And when you said that your code displays a couple of figures, then graph, then repeat - I guess you are using the sleep functions and making the demo running in an infinite loop, then in that case - maybe that the LCD receives corrupted data at first and then subsequently, it sometimes receives data correctly. It could explain why you get output after 5 minutes, or any random amount of time.

I'd still bet on your wiring and hardware. However it's useless to grope in the dark and guess further. You post your example code (don't feel shy about it) and screenshots of your hardware setup and we'll see how we can help you further.

Pastebin as mentioned in this thread earlier, is a source code sharing service. Just copy paste your code onto it, and post a link on this thread. That's how it works.

Best Regards
Abhishek

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Undefined Reference Error and Other Questions

Postby Tectu » Mon Oct 29, 2012 12:43 pm

Using pastebin doosen't help at all, we need all files.
As I mentioned before, you have to zip your project folder and attach it to a post here. If everything works when you use the ChibiOS example from now on, I guess it's not neccessary anymore.

@Abhishek, This cannot be the wiring or the FSMC settings, it's impossible to get such high delays by that.


~ Tectu

yellowtiger
Posts: 15
Joined: Sun Oct 28, 2012 6:42 pm

Re: Undefined Reference Error and Other Questions

Postby yellowtiger » Tue Oct 30, 2012 5:40 am

Thank you guys for all the replies. I've been busy today and didn't find a chance to play with my board.

As I mentioned in one of my previous posts, I connected my STM32F4 board and my LCD board using the connections found in this post: http://www.element14.com/community/groups/development-tools/blog/2012/05/26/stm32f4-discovery-hy32d-tft-lcd. Here is a table that listed my connection pins:
YT-STM32F4-LCD-Connection1.jpg
YT-STM32F4-LCD-Connection1.jpg (51.89 KiB) Viewed 6374 times


I don't have any PCB board on my hand so I ordered some dupont cable off ebay and use these cables to connect the two boards. Here is a picture of my hardware connection:
YT-STM32F4-LCD-Connection2.jpg
YT-STM32F4-LCD-Connection2.jpg (82.25 KiB) Viewed 6374 times


I have double check the pin connections and they are correct. I have also made sure the connectors sit tight in the pins. So far I'm still getting a relatively long initialization time. I'll keep looking the codes and check my clock settings. I'll probably order more cables for troubleshooting.


Return to “LCD Driver and Graphic Framework”

Who is online

Users browsing this forum: No registered users and 19 guests