phenyl 18 Posted October 6, 2017 Share Posted October 6, 2017 Hi All First, I would like to thank @Rei Vilo for providing the Library for the Kentec (BOOSTXL-k350qvg) library with Energia. I copied the code out of https://www.youtube.com/watch?v=XyeUpk6P4kA (as I didn't find the powerpoint or pdf) and got it to work with an MSP430F5529 launchpad. (Energia 18, Windows as the Mac version doesn't work atm). Then I compiled the same code on a MSP432P401R launchpad and it runs a lot slower than on the F5529 (I assume this is a known issue, due to slow SPI speed ( https://github.com/energia/msp432-core/issues/27 ) but also doesn't look the same, the fonts are "skinnier on the MSP432. This discrepancy, I cannot explain. Another question: If I want to write a changing variable, in this case simply the x-coordinate of the touch to the screen, how do I locally clear the screen without redrawing everything (or if I want to make a bar graph that represents eg a changing value of a sensor? Do I always draw a black rectangle, then the bar/text etc? or is there a simpler way that is not immediately obvious to me now? Next step: I have to learn more about state machines to switch screens (settings), do stuff there, come back to main without the program getting into badly readable territory. Thank you very much for your help. //First steps with the Kentec Display #include "SPI.h" #include "Screen_K35_SPI.h" Screen_K35_SPI myScreen; uint16_t colours[6]; uint16_t x; uint16_t y; uint16_t z; uint8_t initFlag; void setup() { Serial.begin(9600); Serial.println(); Serial.println("hello"); Serial.println(); pinMode(RED_LED, OUTPUT); myScreen.begin(); myScreen.clear(); colours[0] = myScreen.calculateColour(255, 0, 0); colours[1] = myScreen.calculateColour(0, 255, 0); colours[2] = myScreen.calculateColour(0, 0, 255); colours[3] = myScreen.calculateColour(255, 255, 255); colours[4] = myScreen.calculateColour(255, 255, 0); colours[5] = myScreen.calculateColour(0, 0, 0); x = 0; y = 0; z = 0; myScreen.setPenSolid(true); myScreen.setFontSolid(false); myScreen.setFontSize(2); initFlag = 1; } void loop() { if (initFlag) { drawHomeScreen(); initFlag = 0; } if (myScreen.isTouch() > 0) { myScreen.getTouch(x, y, z); myScreen.gText(10, 10, btoa(x, 8), colours[3]); Serial.print(x); Serial.print(" "); Serial.print(y); Serial.print(" "); Serial.println(z); } if (z > 100) { if ((x < 160 && x > 0) && (y < 240 && y > 100)) { digitalWrite(RED_LED, HIGH); } else if ((x < 320 && x > 160) && (y > 100 && y < 240)) { digitalWrite(RED_LED, LOW); } else if ((x < 320 && x > 160) && (y > 0 && y < 100)) { drawSettingsScreen(); } } } void drawHomeScreen() { myScreen.clear(); myScreen.gText(30, 50, "TOUCH LCD DEMO", colours[4]); myScreen.rectangle(0, 100, 160, 239, colours[1]); myScreen.gText(50, 180, "ON", colours[0]); myScreen.rectangle(160, 100, 319, 239, colours[0]); myScreen.gText(235, 180, "OFF", colours[1]); myScreen.rectangle(160, 0, 319, 100, colours[2]); myScreen.gText(180, 50, "SETTINGS", colours[3]); } void drawSettingsScreen() { myScreen.clear(); myScreen.gText(10, 10, "TOUCH LCD DEMO", colours[0]); myScreen.gText(10, 30, "TOUCH LCD DEMO", colours[1]); myScreen.gText(10, 50, "TOUCH LCD DEMO", colours[2]); myScreen.gText(10, 70, "TOUCH LCD DEMO", colours[3]); myScreen.gText(10, 90, "TOUCH LCD DEMO", colours[4]); } Quote Link to post Share on other sites
dubnet 238 Posted October 6, 2017 Share Posted October 6, 2017 I vaguely remember something a while back on the E2E forums with regard to the Kentec driver/library not being right on the 432. If I recall correctly, there was an updated version referred to which sped up the display significantly and made the original poster happy. A well worded search should find that thread. EDIT: Did a few searches and couldn't find it. Perhaps it was not the 432 but a Tiva issue. That's the trouble with vague memories.... You may want to try posting on E2E if you can't find it by searching. If it is indeed the issue I seem to remember, then perhaps one of the TI guys might recall and be able to help out. phenyl 1 Quote Link to post Share on other sites
phenyl 18 Posted October 7, 2017 Author Share Posted October 7, 2017 9 hours ago, dubnet said: I vaguely remember something a while back on the E2E forums with regard to the Kentec driver/library not being right on the 432. If I recall correctly, there was an updated version referred to which sped up the display significantly and made the original poster happy. A well worded search should find that thread. EDIT: Did a few searches and couldn't find it. Perhaps it was not the 432 but a Tiva issue. That's the trouble with vague memories.... You may want to try posting on E2E if you can't find it by searching. If it is indeed the issue I seem to remember, then perhaps one of the TI guys might recall and be able to help out. Hi @dubnet Thank you very much for your answer, I think this issue was for ccs. With ccs6 there was a slow TI GraphicsLib and they sped it up significantly for ccs v7 but I am not sure that one can just drop that into energia and be done with it. I did run the CCSv7 Demo on the MSP432 and it was FAST. (I am not ready for jumping over to the world of direct register manipulation tho... Energia is a good compromise for me in order to get ahead with my hobby projects...) Quote Link to post Share on other sites
Rei Vilo 695 Posted October 7, 2017 Share Posted October 7, 2017 Quote Another question: If I want to write a changing variable, in this case simply the x-coordinate of the touch to the screen, how do I locally clear the screen without redrawing everything (or if I want to make a bar graph that represents eg a changing value of a sensor? Do I always draw a black rectangle, then the bar/text etc? or is there a simpler way that is not immediately obvious to me now? Just perform something like myScreen.setPenSolid(true); myScreen.dRectangle(x, y, a, b, myColours.black); with x, y as coordinates, and a, b as size. phenyl 1 Quote Link to post Share on other sites
Rei Vilo 695 Posted October 7, 2017 Share Posted October 7, 2017 @phenyl The LCD_screen - Reference Manual is available on the libraries sub-folders of the Energia folder, or online at https://github.com/energia/Energia/blob/master/hardware/msp430/libraries/EduBPMKII_Screen/LCD_screen - Reference Manual.pdf phenyl 1 Quote Link to post Share on other sites
SSpatch 0 Posted March 22, 2018 Share Posted March 22, 2018 Thanks to Rei Vilo for the Screen_K35_SPI.cpp library and to Phenyl for posting the above sketch. Question...has anyone had luck getting the BOOSTXL-K350QVG-S1 to run on the MSP432P401R (Red board Ver 2.1) using Energia? I was able to run the example Phenyl posted above on a MSP430F5529LP however have not been able to get video to display on the MSP432P401R. When using the MSP432P401R, the above Energia sketch compiles fine and the code seems to run properly as expected as the touch screen x,y,z values are displayed on the COM port and the LED toggles on and off as expected...just cant see the video properly. I have read that the MSP432P401R implements the SPI bus slower and suspected that might be the problem however I was able to run the MSP432P401R/BOOSTXL-K350QVG-S1 examples in CCS7.4 successfully which leads me to believe that there may be a solution in the Energia libraries used with this LCD. Any help or guidance would be most appreciated. Quote Link to post Share on other sites
Rei Vilo 695 Posted April 5, 2018 Share Posted April 5, 2018 It seems this is a hardware bug with the MSP432. Two options: Use the LaunchPad w/ MSP432 EMT (48MHz) instead of RED LaunchPad w/ MSP432 EMT (48MHz) red board. Configure SPI on the MSP432 red as follow: SPI.begin(); SPI.setDataMode(SPI_MODE1); // ... Now, you will need to dig deep into the Adafruit library to modify the SPI settings. 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.