NXP Semiconductors freescale MCF5225X Manual
MCF5225X—Lab Tutorials 5 and 6 (sheet 3 of 3)TOWER SYSTEMLab Tutorials for TWR-MCF5225XLAB5Finding an Error UsingTask Aware Debugging(TAD) in CodeWarrior™This lab will show you the power of usingtask-aware debugging to troubleshoot yourapplication. An error has purposely beenintroduced into this project, and this lab willshow you how to find and solve that error.Demonstrates• Sending messages between tasks(logging task)• CodeWarrior task-aware debugging windowsStep by Step Instructions1. Stop the application if it is currently running(Debug>Kill)2. Open the Lab Project by selecting theFile > Open menu item:C:\Program Files\FreescaleMQX3.4\demo\hvac_error\codewarrior\hvac_error_twrmcf52259.mcp3. Enable the auto logging feature. This is doneby opening the hvac.h file4. Then change the auto logging define:#define DEMOCFG_ENABLE_AUTO_LOGGING 0to this:#define DEMOCFG_ENABLE_AUTO_LOGGING 1Figure 1: MQX source tree5. Notice that the impacted files have a redcheck mark beside them to indicate that theyneed to be re-compiled, or are “touched.”Compile, download, and run the applicationas was done in steps 8 to 15 of Lab 1.6. Go to the shell console in hyperterminal.Note that a string of logging informationwill be printed out every 15 seconds. It willalso be printed out when there is an updateto any of the parameters such as thedesired temperature. You can test this bypressing SW1.7. Press SW1 until the desired temperaturegets to 24°C and then use SW3 to bring itback down to 20°C. You should notice thatthe logging will eventually stop and that nomore updates are printed.Figure 2: Up to 24, on the way down it stops logging8. Your job now is to use the task awaredebugging (TAD) feature to check for errors todetermine why this error is happening. To seethe TAD data, pause the application by clickingon the Break icon (which is a red square) orby selecting Break in the Debug menu.Figure 3: Break application executionFigure 4: MQX Task-Aware Debugging menu9. Then click on the MQX pull down menu.Read down the list of available informationwindows and select the one(s) that youmight think would be a good indication as towhat happened.10. One of the TAD windows which will quicklyhelp you to get an application status overviewis Task Summary or Check for Errors.SolutionThe HVAC task is using MQX messagesto send data to the Log task (see HVAC_LogCurrentState() and the Log() functions)in HVAC_Util.c and Logging_Task.c.The HVAC task, as the message sender,assumes each message is “consumed”by the Log task and removed from themessage pool after the text is printedto the console.From the HVAC task error code found in theTask Summary TAD window seen in Figure5, it is apparent that a message could notbe sent because the message pool is full.You can verify this assumption by showingthe Message Pools TAD window (Figure 6)and double-clicking on the one and onlymessage pool entry to bring up the windowshown in Figure 7.Figure 6: Message Pool Summary TAD windowFigure 7: Message pool examined(after double-clicking the pool entry)The message pool is exhausted. Theproblem is on the receiving side, as it isalways the message receiver’s responsibilityto reuse the message object or free it whenno longer needed.Looking at the Logging_task() function,located in Logging_Task.c, you can see themessage is received bymsg_ptr = _msgq_receive(log_qid, 0);and after that the data of the message(the log text) is printedprintf(msg_ptr->MESSAGE);What is missing is deletion of the messageafter the log text is printed:_msg_free(msg_ptr);Add this line: recompile and run theapplication. The message memory will nowbe released after the message is printed out.Figure 8: Correct codeLAB6Ethernet to Serial Bridge,Freescale MQX RTCSThis lab demonstrates how to create abridge between a TCP/IP (telnet) connectionand a serial line.Demonstrates• MQX RTCS TCP/IP network stack• Custom telnet server implementation• Re-directing STDIN and STDOUT outputwithin an MQX taskStep by Step Instructions1. Make the following connections from theTower System to the computer.a. USB debugger connection(J17 on the TWR-MCF5225X module)to a USB port on PCb. Serial port on the TWR-SER module to aserial port on PC (serial cable not included)c. An Ethernet cable between theTWR-SER module and an Ethernetport on your computer2. The first time you connect the USB debuggercable to your PC, Windows will install a driverfor the debugger. Follow the prompts toautomatically detect and install the driver.3. Open the lab project by selecting theFile > Open menu item:C:\Program Files\FreescaleMQX3.4\demo\telnet_to_serial\codewarrior\telnet2ser_twrmcf52259.mcp4. The default IP address of the board is169.254.3.3. Typically, when you connect yourcomputer directly to the board, the computerwill default to an auto IP address on the samesubnet as the board (169.254.x.x), thereforerequiring no setup. Note: The PC may take afew minutes to default to the auto IP addressand make the connection.continued on reverse side...Figure 5: Task Summary TAD window |
Related manuals for NXP Semiconductors freescale MCF5225X
NXP Semiconductors freescale MC92604 User Manual
NXP Semiconductors freescale MPC837xE-RDS User Manual
NXP Semiconductors freescale MED-GLU Quick Start Manual
NXP Semiconductors freescale MC9S12G128 MCU Quick Start Manual
NXP Semiconductors Freescale TWR-S12G240 Quick Start Manual
NXP Semiconductors freescale TRK-S12ZVHY64 Quick Start Manual
NXP Semiconductors MCF5253 Reference Manual
NXP Semiconductors i.MX6ULL Manual
NXP Semiconductors FRDM-MCXA153 User Manual
NXP Semiconductors FRDM-MCXN947 User Manual
This manual is suitable for:
manualsdatabase
Your AI-powered manual search engine