Starting out with the K40 and TWR-LCD

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Starting out with the K40 and TWR-LCD

4,033 Views
SeanMichael
Contributor II

So I am fairly new to developing programs with the Tower System in general, but I have done quite a bit of work on the Freescale HCS12 microprocessor.  Anyways, I was hoping for a little bit of help.  I have been doing quite a lot of research lately, to figure out exactly how I have to go about programming the LCD Screen.  I still do not have any clue.  I want to control it through the K40, as well as have the K40 control one or two other peripheral boards, such as the TWR-SER board.  I was wondering if anybody could possibly point me in the proper direction, for the TWR-LCD.  That is my first goal to accomplish along the way of this project.  I really haven't found any documentation to tell me how to integrate the K40 and the TWR-LCD into a single project.  So I am currently chasing my tail on this one.  Any help would be very much appreciated. 

Tags (2)
28 Replies

2,339 Views
SeanMichael
Contributor II

So I ran it, and left it run, when I pause the program.  It is usually in this set of For Loops.  51-stuckin.PNGIts in a loop in the d4dlcdhw_common.c

static void Cpu_Delay100US(unsigned short us100)
   {
    unsigned int i;
    while((us100--)){
      for(i=0; i < (MCU_BUS_CYCLES_100US/10); i++)
        {// 10 cycles delay
          asm("NOP");
          asm("NOP");
          asm("NOP");
        }
    }
  }

So yea... Where exactly do you guys think I should go from here?  Is there an even more basic way to get the TWR-LCD and K60 to communicate? 

2,339 Views
surjitkumar
Contributor II

SeanMichael

  even i also getting the same issue.Have you got the solution.If yes ,please describe how?

0 Kudos
Reply

2,339 Views
LuisCasado
NXP Employee
NXP Employee
Hi

Display is working as you can run the demo stand alone. You can program and debug the eGui bare metal project. When you pause the app, where is the code?

Are you sure the TWR-LCD is well plugged into TWR-ELV? And TWR-K60 primary into primary connector?

Regards,

Luis
0 Kudos
Reply

2,339 Views
surjitkumar
Contributor II

  even i also getting the same issue.Have you got the solution.If yes ,please describe how?


program is stucking in

Its in a loop in the d4dlcdhw_common.c

static void Cpu_Delay100US(unsigned short us100)
   {
    unsigned int i;
    while((us100--)){
      for(i=0; i < (MCU_BUS_CYCLES_100US/10); i++)
        {// 10 cycles delay
          asm("NOP");
          asm("NOP");
          asm("NOP");
        }
    }
  }


 

0 Kudos
Reply

2,339 Views
SeanMichael
Contributor II

Unfortunately I got that same results.  A White Screen.  As soon as I power the TWR-LCD, I always have a white screen.  I can put it into Bootloader mode, and put the Standalone Demo back on, but I have to keep SW1 as 01000010.  As soon as I switch from that, the screen turns white.

2,339 Views
LuisCasado
NXP Employee
NXP Employee

Hello,

Now you can debug, that is a progress.

The S19 flashed in TWR-LCD is to avoid interferences in touch screen. But that is not your problem now. If your board revision is D, you can run the demo in SPI mode and in Flexbus mode.

Run the app with:

#define D4D_LLD_LCD_HW d4dlcdhw_flexbus_16b

Remove jumper J2 in TWR-K60

The Switch configuration in TWR-LCD is SW1: 10101010

 

Try that

 

Regards,

 

Luis

0 Kudos
Reply

2,339 Views
SeanMichael
Contributor II

Well that seems to be a one time error.  I have been running the program in the debugger.  But my screen is still white.  I do not get anything at all to show up on my screen. 

0 Kudos
Reply

2,339 Views
SeanMichael
Contributor II

So I was stepping through the project, and this error came up.  53-CWError.PNG

I have no Idea if this is the cause of my problems, or just a rare occurrence.  Either way, hopefully it's helpful to you guys.

0 Kudos
Reply

2,339 Views
SeanMichael
Contributor II

Ok I have to be missing something.  So this is what I just did. 

 

1. I downloaded the JM128_BL_TWR_I2c.s19, that you linked in http://www.towergeeks.org/forum/topics/twrk60n512-and-tft.

2. I unplugged the TWR-LCD from the TWR-LCD.

3. I put SW1 to ( 1-Off, 2-On, 3-Off, 4-Off,5-Off,6-Off,7-On,8-Off)

4. Put the TWR-LCD into Bootloader mode, by holding SW3 and pressing SW4 while i had the usb attached to the computer. 

5. I then unplugged the TWR-LCD and put SW1 to (1-On,2-Off,3-On,4-Off,5-On,6-Off,7-On,8-Off)  and verified that all of SW5 was on.

6. I downloaded the eGui from www.freescale.com/eGUI right into my T Drive, where I extracted it into it's own folder on the T Drive.

7.  I plugged the TWR-LCD into the Primary TWR-ELEV. which already had the K60 and the TWR-SER plugged into it. 

8. On the underside of my K60 it has both of these stickers, 700-26548 REV B, and SCH-26548 REV D. Which I am assuming that the Schematic Rev is the one that I am checking to make sure is Rev. D. 

9. I on the top of my board, I made sure that J16 was not jumpered.

10.  First when I opened CW10.1, I made a new workspace on my T Drive. Then immediately did a reset perspectives.  Afterwards I did a file/Import/Existing Files into Workplace => Then searched for T:/Freescale_embedded_GUI_SW/_Official_Demos/EGUI_D4D_Demo/TWR_K60N512/BareMetal/CW_10_1 and hit OK.  made sure that the check box was checked, and hit finish.

11.  Opened up d4d_user_cfg.h in Sources/project/D4D_Configuration and this is what I have now.

Line 89:      //#define D4D_LLD_LCD_HW d4dlcdhw_kinetis_spi
Line 90:      #define D4D_LLD_LCD_HW d4dlcdhw_flexbus_16b

 

12. I then hit build, which everything compiled.

13. I then switched from Internal RAM to Internal Flash, then re built the project.

13.  I plugged my first usb cable into J5 on the Primary TWR-ELEV. 

14. I plugged my second usb cable into J13 on the TWR-K60N512

15.  I then hit Debug, which I choose TWR_K60_MK60N512VD100_INTERNAL_FLASH_PnE U-MultiLink, click OK and wait until the Resume Button at the top of the Debug window becomes available to click. 

16. Click Resume, and my TWR_LCD continues to stay White.  Nothing ever changes on there....  No noise, nothing. 

17. I went back and tried to reverse the two define lines, to make sure that I didn't misread what was written in the other thread.   I commented out the Flexbus line, and uncommented the Spi line, which they now look like the follow.

 

Line 89:      #define D4D_LLD_LCD_HW d4dlcdhw_kinetis_spi
Line 90:      //#define D4D_LLD_LCD_HW d4dlcdhw_flexbus_16b

 

18. I build the project again, then I hit debug and wait for the Resume Button to become available to click again.  Which gives me the same exact result.   

55-IMG_20120202_135126.jpghttps://community.nxp.com/discussions/57-IMG_20120201_163729.jpg" target="_self


So guys... Am I doing something wrong?  I am completely stumped....

0 Kudos
Reply

2,339 Views
vanajagujjala
Contributor III

Hi Michael,

               This is vanaja.I to have same problem like nothing on display,always white screen only.I am diong K60-120MHZ +3.2'inch TWR_LCD with Flexbus interface in 8-bit mode,previously I worked on Flexbus 16-bit mode it is working fine,but it is not working in 8-bit mode.whether you problem is solved or not?can you help me,if your problem is solved or if you know the problem.

Thanks,

vanaja.

0 Kudos
Reply

2,339 Views
LuisCasado
NXP Employee
NXP Employee

Hi,

The error should be removed doing a clean of the project. I have tested the eGUI package projects and your projects. BSPCFG_ENABLE_TCHSRES    1 is needed to get the touchscreen working on MQX + eGUI.

Try the eGUI bare metal example to check if there is a problem in the TWR-LCD settings. You can find here instructions:

 

http://www.towergeeks.org/forum/topics/twrk60n512-and-tft

 

Best Regards,

0 Kudos
Reply

2,339 Views
SeanMichael
Contributor II

Ok, so I rechecked all my jumpers, they are all in the correct locations.  I rechecked the updates, CW 10 is up-to-date.  I reflashed the board using Pemicro.  I copied and replaced my user_config.h file with your Luis Casado.  The only difference was that in mine I had #define BSPCFG_ENABLE_IO_SUBSYSTEM 1, which I did not see in yours, and you have #define BSPCFG_ENABLE_TCHSRES    1 which, I didn't have in mine.  So right now I have one error.  which is the photo that follows.  59-Capture.PNGMy question, is what is the best way to change the location in which CW is looking for that file.  Last time, I hit clean project, and that didn't work out for me all that well.   I made sure my initialize target, and memory configurations, in debug Configs, was set to the proper file directories.

I think I am going to wait until later tonight, when there is nobody else in the school lab, so I can take a video of what I do to set everything up.  If I do, hopefully you guys will find what I am doing wrong.  I did get the file to compile a few minutes ago, then it got caught up when I hit reset, and lost the OSJTAG.  When I hit run, the screen just continues to stay white.  Nothing ever pops up on it. 

Once again, I really have to thank all of you for being patient with me, and helping out.  I truely do appreicate it, and hopefully I am not drive you guys insane.   With me, all the errors I usually have in class, it is usually something very easy to overlook. After finding it, and fixing it, my professors laughing at me and telling me to pay attention to the small details.  I am really hoping that this is another one of those issues.  I suppose time shall tell, and as for what Anthony Huereca said, about getting the program to work, and then being fine, that is what I was hoping for.  Once I can get a working program that I can modify something small, then compile the code, and watch it change something on the screen.  I am usually good at figuring out what I need to do from that point onward, to accomplish my goal.  This part of the project should hopefully be the toughest part.   Anyways, Thanks for all the input guys.

0 Kudos
Reply

2,339 Views
anthony_huereca
NXP Employee
NXP Employee

CW10 has a bit of a learning curve, but once you get a project going, you'll be fine.

As for your current problem, try hitting the pause button while the debugger is going to see where the code might be stuck at. And double check your jumpers (Section 3)

Right now the debugger is trying to run all the way to main() before breaking after you start debugging but seems to be getting lost somewhere. To start the debugger at the very first instruction, you need to modify an option in the debugger configuration.

Go to Run->Debug Configuration

Select the CW_10_1_twrk60n512_Int_Flash_Debug_PnE OSJTAG configuration

Go to the "Debugger" tab at the top of that screen

In the "Program Execution" box, select "Program entry point" instead of the default "User specified: main".

Then you can step through the code line by line to see where it might be getting lost. There will be some assembly at the beginning, but just keep stepping through and eventually you'll reach the hardware init code in C.

Hope that helps!

0 Kudos
Reply

2,339 Views
LuisCasado
NXP Employee
NXP Employee

Hello,

 

Your files work in my PC. I unziped in my eGUI folder and run perfectly. I changed the MQX variable from T:/ to my path to build. But the same connection worked fine in my system.

 

Two suggestions:

 

1. Upgrade the OSJTAG firmware with Pemicro application

 

Firmware Upgrade & Recovery tool

 

http://www.pemicro.com/osbdm/index.cfm

 

2. Be sure you have applied the patches in CW10.1

 

http://www.freescale.com/files/soft_dev_tools/doc/quick_ref_guide/Service_Pack_Updater_Quick_Start.p...

 

Best Regards,

 

Luis

0 Kudos
Reply

2,339 Views
LuisCasado
NXP Employee
NXP Employee

Attached my user_config.h. Please compare to yours.

0 Kudos
Reply

2,339 Views
LuisCasado
NXP Employee
NXP Employee

Hello,

 

That is warning message is not a real issue. That have been changed  in CW10.2. It is a warning about Flash Configuration register that has been modified. Pressing no will flash the app. Is any app running? Do you have the right user_config.h bsp configuration?

Best Regards,

0 Kudos
Reply

2,339 Views
SeanMichael
Contributor II

Well sorry for being a pain yet again, but the program advances, to this box  

62-Capture2.PNG

Where I click on "No", to continue downloading the program.  Which then nothing happens.  It gets stuck like the follow.

64-Capture.PNG

And then that is the extent of it.  I am using the BSP file from Freescale MQX 3.7/mqx/build/cw10/bsp_k60n512.   The project I am using, is the one you just sent me, I have a copy of the original folder, but in the original folder, where I am running the program from.  Freescale_embedded_GUI_SW/_Official_Demos/EGUI_D4D_Demo/TWR_K60N512    I deleted the original MQX_3_7 folder, and replaced it with the one you sent me.  I did a clean project once I imported the file, because I got a make *** target error.  It was looking for the main.c file in D:/working/......   On my computer, there isn't a D drive at all.  Once I did that, it compiled, and got to the two screens I sent you.   The entire time I wrote this message, I let it continue to run, and it hasn't moved at all.

I am starting to wonder, if it's me that attracts all these errors, and problems whenever I work on something new, or are there other people having just as many problems as I am getting the EGUI demo to simply run? 

Anyways, I just want to thank everybody for the help that they have given me, and the help I am still receiving.   I am also going to zip up my files and send them to you guys just in case.  It is the bsp file from the mqx folder installed from mqx 3.7, aswell as the EGUI file you just sent me.  I do not know if they will be of any use, but hey too much information shouldn't be a problem. 

0 Kudos
Reply

2,339 Views
LuisCasado
NXP Employee
NXP Employee

Hello,

 

I have tested the MQX 3.7 project in the eGUI package and worked for me. For some reason the project has lost the connection configuration and I created a new one. Attached my project. You can unzip in the same eGUI package location. \_Official_Demos\EGUI_D4D_Demo\TWR_K60N512

Let me know if it works for you. Otherwise I will guide you to create a New remote system connection for K60 and OSJTAG.

 

Best Regards,

0 Kudos
Reply

2,339 Views
anthony_huereca
NXP Employee
NXP Employee

The best way to start is by going through the Quick Start Demo lab: http://cache.freescale.com/files/32bit/doc/support_info/TWRK60N512QSDLAB.zip

0 Kudos
Reply

2,339 Views
anthony_huereca
NXP Employee
NXP Employee

Starting with the Quick Start Demo was the best way to make sure your setup is working.

The error you're seeing is likely due to that the project is looking for the memory configuration file in MQX that is at the default location.

Go to Run->Debug Configurations from the menu bar.

Then select the the CW_10_1_twrk60n512_Int_Flash_Debug_PnE OSJTAG (or whichever you're using) configuration.

On the screen, there is a box that says "Remote System", and it has a drop down box selection. Click on the "Edit..." button next to that box.

In the dialog box that pops up, click on the "System" tab

Then there are two text boxes specifying the "Initialize target" and "Memory configuration". Edit the paths in those boxes to match where you installed MQX.

Then you should be able to download your code!

0 Kudos
Reply