Undefined Reference Error and Other Questions

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

Re: Undefined Reference Error and Other Questions

Postby Abhishek » Tue Oct 30, 2012 6:35 am

By slow initialization, do you mean, the pattern takes time to appear on the screen, or it appears suddenly after a time interval. What I understand at this point is that you have a blank screen for a couple of minutes and the pattern suddenly appears.

I think it's better you attach at least your main.c file.

Alternatively try this in your code somewhere after initialization of the display:

for (int i=0; i<1000; i++)
gdispClear(Blue);

Check if you get a clear blue pattern or some black dots on screen. This will.verify if your interface is working properly.

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 » Tue Oct 30, 2012 7:12 am

I agree with Abhishek, you should really show us your code. It's really hard to help otherwise.
Have you tried to take the ChibiOS example for the F4 Discovery and simply replace your main.c by the one of the graph demo?


~ 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 7:44 am

Hi Abhishek and Tectu,

I don't know if "slow initialization" is the right description of the problem. Basically what happens is that after I disconnect the USB cable and reconnect it to the STM board, the LCD screen lights up but is blank (in white color). It keeps to be blank for a while (~ 1min if I'm lucky or ~5min if I'm unlucky). Then I pressed the black onboard reset button and LCD shows what's supposed to show. During that "waiting while" nothing would happen if I pressed the reset button.

I did a simple test. I took the Chibios STM32F4Discovery example code, replaced main.c with a simple code to show a blue screen using gdispClear(Blue), edited halconf.h and Makefile, compiled the program and flashed it to the STM board using st-flash. Again, the same thing happened - I had to wait about 1min before the screen shows solid blue. I have attached a zip file in this post so that you guys can take a look at it.

Hope you guys can shine some lights on me. Thanks.
LCD-Simple-Test.zip
(11.46 KiB) Downloaded 269 times

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

Re: Undefined Reference Error and Other Questions

Postby Abhishek » Tue Oct 30, 2012 1:45 pm

I'm afraid, "Slow initialization" is the wrong word to use for this problem. It got us thinking in other ways, might have been interpreted as slow interface speed and clock problems. I can confirm none of all this is your problem.

Your 'luck' or randomness is actually a play of the long wires which might be corrupting the high speed digital signals. I'm sure this is related to your wiring - which is not able to cope with the bus speed - maybe parasitic capacitance of the wires is playing havoc with the short WR pulses. I have encountered these kind of problems when I started working with LCDs a few years ago - that was a small Nokia 6610 LCD, and I have seen the same 'random behaviour' with them also - the LCD was expected to display content 20 times if I reset it a 100 times, and remain blank the rest of the time. When I decreased the SPI bus frequency, it went away [but the update speed decreased as expected]. When I wired them up properly on a PCB, I was able to increase the SPI bus speed, and the LCD worked good, every reset.

That is why you might need to add more HCLK cycle delays in the FSMC set-up [this is low-level stuff, we will tell you how to do it] to make it work as of now. You may also try wiring up the LCD on a proper PCB, using burg strips and thinner wires - which have less capacitance and will be able to handle high-speed signals adequately.

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 » Tue Oct 30, 2012 10:44 pm

I do now agree with Abhishek. If you press the reset button so many times and it only works after a some minutes might indeed be because the initialization dosen't happen the right way because of interface issues.

Yellowtiger, you could try to simply lower your FSMC frequency in the file gfx/drivers/gdisp/SSD1289/gdisp_lld.c.


~ Tectu

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

Re: Undefined Reference Error and Other Questions

Postby yellowtiger » Wed Oct 31, 2012 5:50 am

Hi guys, thanks for the reply. I was reading the reference manual of the STM32F4 board family. I have to admit that most stuff in the reference manual is beyond my knowledge base. But I'll try my best. If I understand it correctly, I have to set the bits in the FSMC_BTR1 register to change the FSMC timing, right? I'm still reading to see what values I should set the bits to. I did try one thing - changing the bit values for FSMC_BTR1_CLKDIV but it had no effect (I might have done it wrong though). So while I'm reading the manual, can you guys give a hint what to change and how to change it?

I went ahead and purchased a pcb board and some 50-pin female headers. I was able to solder the headers to the pcb board (shown below). However, I'm not sure how to connect the corresponding pins between the STM32F4 board headers and the LCD header. Do you think I can use thin magnet wires (strip the ends and solder to the pins)?

YT-PCB-Front.jpg
YT-PCB-Front.jpg (42.93 KiB) Viewed 4864 times


YT-PCB-Back.jpg
YT-PCB-Back.jpg (49.56 KiB) Viewed 4864 times

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

Re: Undefined Reference Error and Other Questions

Postby yellowtiger » Wed Oct 31, 2012 5:59 am

I also want to mention that I have noticed after waiting for the initial random waiting time and the LCD starts to display things, everything seems working fine as long as I don't disconnect the power. I mean, as long as the LCD starts to work and I don't disconnect the USB cable, I can flash newly-compiled program to the board and the LCD works right after the flashing. So I was wondering if the timing was off why would the LCD work well after the initial waiting time?

mobyfab
Posts: 483
Joined: Sat Nov 19, 2011 6:47 pm
Location: Le Mans, France
Has thanked: 21 times
Been thanked: 30 times

Re: Undefined Reference Error and Other Questions

Postby mobyfab » Wed Oct 31, 2012 9:50 am

FSMC_BTR1_CLKDIV is only for the clock pin output, which is not used in our case.

What program do you use to flash the F4?

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

Re: Undefined Reference Error and Other Questions

Postby Abhishek » Wed Oct 31, 2012 12:02 pm

Hello yellowtiger,

Try this: In the file gfx/drivers/gdisp/SSD1289/gdisp_lld.c, look for

Code: Select all

FSMC_Bank1->BTCR[FSMC_Bank+1] = (FSMC_BTR1_ADDSET_1 | FSMC_BTR1_ADDSET_3) \
| (FSMC_BTR1_DATAST_1 | FSMC_BTR1_DATAST_3) \
| (FSMC_BTR1_BUSTURN_1 | FSMC_BTR1_BUSTURN_3) ;


and replace it with:

Code: Select all

FSMC_Bank1->BTCR[FSMC_Bank+1] = (6) | (15 << 8) | (15 << 16);


These are the maximum possible write delays i.e. slowest FSMC speed. If you still face the same problem, then try wiring it up on the PCB.

What I can think of is, once the LCD gets initialized properly, future initialization don't disturb the setup. There is a reset pin, which is not used, so once it is initialized after power up, it would work right away without initializations by the MCU, until the LCD is reset by shorting the RESET pin to ground, or power to the LCD is removed and re-connected, after which it needs to be init again.

I'm not sure about magnetic wires, but here are a few pics of my setup, which is almost like yours. Have a look, maybe this is what you would want to have. The wires are quite thin:

dsc01779t.jpg
Back view
dsc01779t.jpg (210.1 KiB) Viewed 4855 times


top view - 1.jpg
Top view
top view - 1.jpg (127.92 KiB) Viewed 4855 times


Best Regards

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 » Wed Oct 31, 2012 12:14 pm

I start thinking that the LCD that yellowtiger got migt consume too much power. At least that's a strange thing with de USB.
I know that not all the SSD1289 modules on eBay are the same. For example, I have two which look very similar, but one takes about 30mA more. I guess they used different backlight LEDs. You could try to put a resistor in series of the backlight.

I'd say wire it up on the PCB and then hope that it will work. Remember to try the lower FSMC settings.
You don't have to use those "magnetic wires". You can simply take any wire with an insulation. I use myself wires with 0.25mm^2


Good luck!


~ Tectu


Return to “LCD Driver and Graphic Framework”

Who is online

Users browsing this forum: No registered users and 28 guests