-deleted-
10 years, 1 month ago.

Libraries

Hi, i tried use library for 6610 LCD, which works on my LPC1768, on my new Nucleo. But on Nucleo it doesnt work. No compilation error, but Nucleo doesnt work. I created new Nucleo program, import 6610 LCD library and tried this simple code:

  1. include "mbed.h"
  2. include "NokiaLCD.h"

NokiaLCD lcd(PB_1, PB_15, PB_14, PB_13, NokiaLCD::LCD6610); DigitalOut led(PA_5);

int main() { led = 1; }

When i comment NokiaLCD(...), LED shines. But when i uncomment LCD init., then is LED turned off. Am i doing something wrong, or i cant use LPCs libraries on Nucleo?

Thanks for your answer

Vojta

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F401RET6 microcontroller.

Do you have any chance to debug it ? Based on you description, looks like it gets stucked somewhere in the LCD constructor. Unfortunately, I don't have any nucleo board at the moment.

Please, use syntax <<code>> <</code>> (each on it's own line), where you share code with us. Thanks.

Regards,
0xc0170

posted by Martin Kojtal 27 Feb 2014

I am quite new here, so i dont know, how to debug yet. I think it is in constructor, too. Maybe its because LCD. library uses mbed.h, but Nucleo has this standard library little different from LPC...

posted by -deleted- 27 Feb 2014

1 Answer

10 years, 1 month ago.

I don't know if that will be the cause it hangs, but for sure issue 1 is that the LCD required the not exactly standard 9-bit SPI format, and looking at the Nucleo code, it doesn't support it:

if (bits == 8) {
        obj->bits = SPI_DATASIZE_8BIT;
    }
    else {
        obj->bits = SPI_DATASIZE_16BIT;
    }

However clearly instead of giving an error, it sets it as 16-bit mode. No idea why it then hangs, but for sure it isn't going to work. You can have a look at: https://mbed.org/users/jppang/code/NokiaLCD_SWSPI/, there the SPI uses bitbanged software SPI, which should work on every microcontroller. Obviously not ideal compared to hardware spi, but it should work.

I tried, but no difference :-/

Thanks anyway ;-)

posted by -deleted- 27 Feb 2014

Did you change the name of the class also to NokiaLCD_SWSPI? You are correct it must be the constructor, you can try commenting stuff out until it does enable the LED, then you know that whatever you commented out is the issue. But the Nucleo uses the same mbed.h.

posted by Erik - 27 Feb 2014