/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / Primer2 CAN-bus and FSMC lcd driver problem

Username:     
Password:     
             

Forum

# 1   2009-04-13 21:03:58 Primer2 CAN-bus and FSMC lcd driver problem

ingenius
Member
From: Belgium
Registered: 2009-02-26
Posts: 10

Primer2 CAN-bus and FSMC lcd driver problem

Hello,

I think that it is impossible to use the stm32 CAN controller and the FSMC LCD controller at the same time on the Primer2 hardware.

The CAN hardware pins needs to be remapped to PD0 and PD1. From the moment you enable the FSMC clock, PD0 and PD1 is locked to the FSMC controller as datapin D2 and D3 and CAN doesn't work anymore until you disable the FSMC clock again.

I see two solutions.

1. Primer2 hardware change with remap CAN to PB8 and PB9
2. Don't use the FSMC controller to drive the lcd (software lcd databus)

Any suggestions?

Offline

 

# 2   2009-04-14 09:11:58 Primer2 CAN-bus and FSMC lcd driver problem

pisi
Member
Registered: 2009-02-19
Posts: 17

Re: Primer2 CAN-bus and FSMC lcd driver problem

Hello ingenius,

I also want to use CAN and LCD at the same time.
But, either I do not understand your problem or there is none.

as far as I know these pins are used by the LCD:
- PE7 (data0)
- PE8 (data1)
- ...
- PE14 (data7)

- PD4 (RD)
- PD5 (WR)
- PD6 (RST)
- PD11 (RS)

- PD7  (CS)

CAN is mapped to PD0 and PD1.

Where is the problem?

Offline

 

# 3   2009-04-14 10:13:36 Primer2 CAN-bus and FSMC lcd driver problem

ingenius
Member
From: Belgium
Registered: 2009-02-26
Posts: 10

Re: Primer2 CAN-bus and FSMC lcd driver problem

Hello Pisi,

If you try both CAN and the lcd by the FSMC at the same time you will soon find out that the CAN will stop to function the moment you enable the FSMC clock.

If you look at the STM32F103xC datasheet you see "Table 6. FSMC pin definition (continued)" page 36/115 that the FSMC controller uses PD0 and PD1 in all modes as D2 and D3.

Those two pins PDO and PD1 are needed for the CAN on the Primer2.

Remapping the PD0 and PD1 pin to the CAN TX and RX doesn't help? I don't understand why this doesn't work? Maybe the FSMC locks the PD0 and PD1 pins if you enable it??

Can someone confirm this please?

http://www.ptp-images.com/mini/rhzrp365ca.jpg

Offline

 

# 4   2009-04-14 10:28:52 Primer2 CAN-bus and FSMC lcd driver problem

pisi
Member
Registered: 2009-02-19
Posts: 17

Re: Primer2 CAN-bus and FSMC lcd driver problem

ingenius,

I can confirm that CAN and LCD don't work at the same time.
deactivating the LCD init routine makes CAN working agan sad
that's bad!

ideas?

Offline

 

# 5   2009-04-14 13:03:38 Primer2 CAN-bus and FSMC lcd driver problem

pisi
Member
Registered: 2009-02-19
Posts: 17

Re: Primer2 CAN-bus and FSMC lcd driver problem

disabling FSMC clock again (RCC_AHBPeriphClockCmd (RCC_AHBPeriph_FSMC, DISABLE);
makes CAN working.

So, do I have to switch FSMC on an off in order to disply CAN data on the display?

Offline

 

# 6   2009-04-15 19:27:41 Primer2 CAN-bus and FSMC lcd driver problem

ingenius
Member
From: Belgium
Registered: 2009-02-26
Posts: 10

Re: Primer2 CAN-bus and FSMC lcd driver problem

Any comment for this problem from the ST/Raisonance side is most welcome?

Offline

 

# 7   2009-04-15 21:17:24 Primer2 CAN-bus and FSMC lcd driver problem

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: Primer2 CAN-bus and FSMC lcd driver problem

I forwarded the post to ST... Hope they will answer.

Offline

 

# 8   2009-04-16 09:58:10 Primer2 CAN-bus and FSMC lcd driver problem

kubark42
Member
Registered: 2009-02-13
Posts: 46

Re: Primer2 CAN-bus and FSMC lcd driver problem

Another idea would be to turn off the display functionality except when you need it. The LCD display only redraws when it's explicitly told to, so if you simply draw your image-- for instance a character-- and then turn the FSMC off you'll be able to go back to using the CAN without losing the image. I'm not sure how long that would take, but you can do it quite easily from pure C code, or perhaps CircleOS code modified to turn off the display handler.

It's more a hack than a solution, but it should work if you don't need lots information displayed on the screen and your CAN bus can handle the occasional disruption.

Offline

 

# 9   2009-04-16 11:15:06 Primer2 CAN-bus and FSMC lcd driver problem

pisi
Member
Registered: 2009-02-19
Posts: 17

Re: Primer2 CAN-bus and FSMC lcd driver problem

kubark42,

switching FSMC on and of is exactly what I described above.

There are two problems with this workaround:
A) while FSMC is on, I can't listen to the bus and may miss packets.
B) while FSMC is on, are there any side-effects (e.g. FSMC causes noise on the CAN bus)?

Offline

 

# 10   2009-04-16 12:01:11 Primer2 CAN-bus and FSMC lcd driver problem

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: Primer2 CAN-bus and FSMC lcd driver problem

I just modified CircleOS 3.7 for the STM32F107 that is pin compatible with the STM32F103 but:
1. STM32F107does not have FSMC (I had to manage the LCD manually, as done for Primer1),
2. STM32F107 allows USB and CAN to work simultaneously.

This version of CircleOS could help. I am wondering if, even for 103, the use of FSMC could be optional (it would allow CAN to work..),
BTW, I also asked ST for information about the CAN+FSMC issue and I am still waiting for their feedback.

Offline

 

# 11   2009-04-16 19:24:54 Primer2 CAN-bus and FSMC lcd driver problem

ingenius
Member
From: Belgium
Registered: 2009-02-26
Posts: 10

Re: Primer2 CAN-bus and FSMC lcd driver problem

Francis, can't wait what ST has to say about the CAN+FSMC problem. Did you experience the same problem during your test?

With the STM32F107 having no FSMC in mind I think for now the best solution is to use the software or manual lcd driver. So I'm very interested in your lcd.c code? Can you make that public?

Another solution is to change the Primer2 hardware and remap the CAN pins to PB8 and PB9, but I haven’t tested that one yet..

Offline

 

# 12   2009-04-16 20:41:06 Primer2 CAN-bus and FSMC lcd driver problem

pisi
Member
Registered: 2009-02-19
Posts: 17

Re: Primer2 CAN-bus and FSMC lcd driver problem

isn't b8 used to drive the lcd backlight?

Offline

 

# 13   2009-04-17 07:10:51 Primer2 CAN-bus and FSMC lcd driver problem

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: Primer2 CAN-bus and FSMC lcd driver problem

During our tests, we just ran some CAN examples without CircleOS (thus without FSMC). 

I will send you the current evolution of CircleOS. It is not finalized and there are still some problems : it seems to work well in debug mode, but the screen stays white when we start in standalone mode (from the battery).  Anyway, I prepare the ZIP that will be posted later today.

Offline

 

# 14   2009-04-17 11:45:52 Primer2 CAN-bus and FSMC lcd driver problem

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: Primer2 CAN-bus and FSMC lcd driver problem

Pisi, Ingenius,
I sent you by mail the current lcd.c file that supports 'non-FSMC' mode.
If anybody else needs this file, just let me know...

Offline

 

# 15   2009-04-20 13:23:34 Primer2 CAN-bus and FSMC lcd driver problem

Orakul
New member
Registered: 2009-04-18
Posts: 1

Re: Primer2 CAN-bus and FSMC lcd driver problem

Hi Francis, can you send it to me too (orak_2 at yahoo dot com). Thanks.

Last edited by Orakul (2009-04-20 13:26:29)

Offline

 

# 16   2009-04-20 13:56:52 Primer2 CAN-bus and FSMC lcd driver problem

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: Primer2 CAN-bus and FSMC lcd driver problem

Done.

Offline

 

# 17   2009-04-27 13:34:33 Primer2 CAN-bus and FSMC lcd driver problem

pisi
Member
Registered: 2009-02-19
Posts: 17

Re: Primer2 CAN-bus and FSMC lcd driver problem

any news about this?

Offline

 

# 18   2009-04-27 14:13:05 Primer2 CAN-bus and FSMC lcd driver problem

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: Primer2 CAN-bus and FSMC lcd driver problem

Didn't you receive the email? (sent on 2009-04-17 at 1.44 p.m.)

Offline

 

# 19   2009-04-27 14:31:53 Primer2 CAN-bus and FSMC lcd driver problem

pisi
Member
Registered: 2009-02-19
Posts: 17

Re: Primer2 CAN-bus and FSMC lcd driver problem

I received that mail, but it doesn't provide a solution for the CAN+LCD problem.

Offline

 

# 20   2009-04-27 14:34:43 Primer2 CAN-bus and FSMC lcd driver problem

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: Primer2 CAN-bus and FSMC lcd driver problem

It shows how to replace the FSMC by a direct control of the GPIO. I understood that the FSMC was the issue..

Offline

 

# 21   2009-04-27 19:01:26 Primer2 CAN-bus and FSMC lcd driver problem

ingenius
Member
From: Belgium
Registered: 2009-02-26
Posts: 10

Re: Primer2 CAN-bus and FSMC lcd driver problem

Hello Francis,

Did you already have an answer from ST about the FSMC and CAN problem?

Offline

 

# 22   2009-04-28 06:41:30 Primer2 CAN-bus and FSMC lcd driver problem

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: Primer2 CAN-bus and FSMC lcd driver problem

No... I asked twice, but without success. I will try once more.

Offline

 

# 23   2009-05-11 07:33:20 Primer2 CAN-bus and FSMC lcd driver problem

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: Primer2 CAN-bus and FSMC lcd driver problem

I got an answer from ST. It is a known 'feature'. It will be published in a future errata.
Conclusion: the solution consists in not using the FSMC and addressing the LCD 'manually' while using CAN.

Offline

 

# 24   2009-05-14 22:04:50 Primer2 CAN-bus and FSMC lcd driver problem

pisi
Member
Registered: 2009-02-19
Posts: 17

Re: Primer2 CAN-bus and FSMC lcd driver problem

Francis, I've managed to use your lcd.c to get the display running without FSMC!
many thanks.

Offline

 

# 25   2009-05-15 06:14:07 Primer2 CAN-bus and FSMC lcd driver problem

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: Primer2 CAN-bus and FSMC lcd driver problem

If you fix bugs in 'my lcd.c' please send me the update (I remember it was not finalized).
Thanks,

Offline

 

Board footer