Rei Vilo 695 Posted August 2, 2012 Share Posted August 2, 2012 Hi, I tried to port the (Universal) Color LCD graphics library for the Color LCD BoosterPack to Energia but didn't manage to get it work. Any help? Quote Link to post Share on other sites
bluehash 1,581 Posted August 2, 2012 Share Posted August 2, 2012 I'm not familiar with Energia.. but more info would be nice.. compiler errors.. memory etc? Quote Link to post Share on other sites
RobG 1,892 Posted August 2, 2012 Share Posted August 2, 2012 The first thing you should do is remove all Nokia related code, it will make things easier. Quote Link to post Share on other sites
Rei Vilo 695 Posted August 3, 2012 Author Share Posted August 3, 2012 Hi! Thanks for the tips. I've cleaned the original code, added a setup() and loop() functions. Please find it attached: colourLCD_main.zip There's no error during compilation and upload. When running, the screen remains white. I logged the SPI channels: colorLCD.logicdata.zip Quote Link to post Share on other sites
RobG 1,892 Posted August 3, 2012 Share Posted August 3, 2012 Channel #1 looks like MOSI, not MISO Channel #3 is D/C, not enable, right? Were you able to get your LCD to work with my original library? Also, removed more unnecessary stuff, see attached files. colorLCD.cpp colorLCD.h Rei Vilo 1 Quote Link to post Share on other sites
Rei Vilo 695 Posted August 3, 2012 Author Share Posted August 3, 2012 Yes, you're right! Thanks! I've included the updated .h and .cpp files and here are the new traces: SLEEPOUT 0x11 Quote Link to post Share on other sites
RobG 1,892 Posted August 3, 2012 Share Posted August 3, 2012 Do you have jumpers on the 2x2 header (horizontal)? Can you do capture during readIDs()? You should see LCD response on MISO. Try increasing delay before communicating with LCD to ~1s. __delay_cycles(16000000); // wait before reading IDs Quote Link to post Share on other sites
Rei Vilo 695 Posted August 4, 2012 Author Share Posted August 4, 2012 Thank you for your help. Do you have jumpers on the 2x2 header (horizontal)? No, I removed the jumpers for P1.0 and P1.6. Can you do capture during readIDs()? You should see LCD response on MISO. The MISO line is empty. Try increasing delay before communicating with LCD to ~1s. __delay_cycles(16000000); // wait before reading IDs Could you please post the compiled .hex file so I can upload it with mspdebug and check my screen is fine? mspdebug rf2500 --force-reset prog colourLCD_main.hex I opened the issue :arrow: Color LCD Booster Pack Library on Energia at the Energia GitHub repository. Quote Link to post Share on other sites
RobG 1,892 Posted August 4, 2012 Share Posted August 4, 2012 Thank you for your help.No, I removed the jumpers for P1.0 and P1.6. I was referring to J3 on the LCD board, see the picture on github Could you please post the compiled .hex file so I can upload it with mspdebug and check my screen is fine?mspdebug rf2500 --force-reset prog colourLCD_main.hexI am not using mspdebug or Energia, but I can test your code and report. Rei Vilo 1 Quote Link to post Share on other sites
RobG 1,892 Posted August 4, 2012 Share Posted August 4, 2012 Code works as expected. However, read functions do not work with JD-T, they were used for Nokia displays. I will fix them later on. Quote Link to post Share on other sites
Rei Vilo 695 Posted August 4, 2012 Author Share Posted August 4, 2012 Thank you for your help.No, I removed the jumpers for P1.0 and P1.6. I was referring to J3 on the LCD board, see the picture on github I didn't place the jumpers J3 correctly :oops: . They are now horizontal and the screen works fine as expected! The USI / USCI is rather confusing. I've faced the same mistake with the RX / TX jumpers. Thank you so much for your help! :thumbup: Quote Link to post Share on other sites
RobG 1,892 Posted August 4, 2012 Share Posted August 4, 2012 Nice! It's always the small things USCI - output is on P1.7, input on P1.6 USI - output on P1.6, input on P1.7 On my next board, I will have USCI shorted by default. Here's working readChar function that can be used to read RDID1, RDID2, and RDID3 for example. char readChar(char command) { char a = 0; char c = 0; LCD_SELECT; P1OUT &= ~LCD_DC_PIN; while (c < 8) { (command & BIT7) ? (P1OUT |= LCD_SD_PIN) : (P1OUT &= ~LCD_SD_PIN); LCD_CLOCK; command <<= 1; c++; } P1DIR &= ~LCD_SD_PIN; while (c < 16) { a <<= 1; P1OUT |= LCD_SCLK_PIN; if (P1IN & LCD_SD_PIN) a |= BIT0; P1OUT &= ~LCD_SCLK_PIN; c++; } LCD_DESELECT; P1DIR |= LCD_SD_PIN; return a; } Rei Vilo 1 Quote Link to post Share on other sites
Rei Vilo 695 Posted August 4, 2012 Author Share Posted August 4, 2012 Please find the working library for Energia attached. colourLCD_main.zip One caveat however: nothing is displayed when Serial is used. Just uncomment the lines to do the test. // Serial.begin(9600); // Serial.println("colorLCD"); I'm reporting it to :arrow: Color LCD Booster Pack Library on Energia on GitHub. bluehash and energia 2 Quote Link to post Share on other sites
Rickta59 589 Posted August 5, 2012 Share Posted August 5, 2012 I think you are encountering a pin conflict. Serial uses P1.1 and P1.2. It looks like the color lcd code uses P1.2. #define LCD_SCE_PIN BIT2 #define LCD_SELECT P1OUT &= ~LCD_SCE_PIN #define LCD_DESELECT P1OUT |= LCD_SCE_PIN You might try changing LCD_SCE_PIN to a different unused pin. -rick Quote Link to post Share on other sites
RobG 1,892 Posted August 5, 2012 Share Posted August 5, 2012 I am making changes to the newest version of my CLCD booster pack, so if you have suggestions or requests, now is the time Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.