Author Topic: Demo crashes on Towerkit  (Read 8539 times)

Offline raf1hh

  • Newbie
  • *
  • Posts: 3
    • View Profile
Demo crashes on Towerkit
« on: March 29, 2011, 05:11:11 PM »
Hi All,

I was able to flash the Kinetis demo on to my Tower board, however the demo seems highly unstable and keeps rebooting the board. I am able to connect to it through serial on the serial/ethernet board, I can see the the main menu and actually sometimes traverse the menu, but more often than not the app will crash and reboot the board when I try to actually do anything with it. For instance: when I try to change the ip it will crash and reboot when typing set_ip_add without actually getting to issue the command.

Any ideas what might be causing this?

Thanks

Raf

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: Demo crashes on Towerkit
« Reply #1 on: March 29, 2011, 05:57:52 PM »
Raf

Which version are you using? Which compiler and which options are selected - also do you have a TFT display board?

I would strip down some options until it becomes stable (eg. without Ethernet) so that the moduel causing problem can be identified.

Regards

Mark

Offline raf1hh

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Demo crashes on Towerkit
« Reply #2 on: March 29, 2011, 06:58:06 PM »
Hey Mark,

thanks for getting back to me so quickly. Here is my setup:

Compiler: IAR Workbench 6.0

The demo setup is vanilla Beta 1.4.5 plus these options enabled:

SERIAL_INTERFACE
ETH_INTERFACE
USB_INTERFACE

although I did disable the ethernet and usb just to see if it will make a difference and it did not.

I do have one more observation: after flashing the demo, the board is actually on a 30 second reset cycle without me doing anything to it. Just to make sure that I don't have bad hardware, I did flash one of my sample mqx apps and the board is stable.

Which options is it safe to disable in config.h to get a bare-bones system?

Thanks

Raf

Offline raf1hh

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Demo crashes on Towerkit
« Reply #3 on: March 29, 2011, 06:58:46 PM »
Sorry forgot: I don't the TFT board.

raf

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: Demo crashes on Towerkit
« Reply #4 on: March 29, 2011, 08:25:08 PM »
Raf

I will have a go with your configuration and IAR to see whether I get the same.

In the meantime, note that the newer versions have new features that are not tested in all environments - the older versions are there in case something breaks during the development work and you should find that the Beta 0.0, although with less features, will work OK with IAR (IAR was tested quite well then).

As quick ideas I would disable the PIT timer test in (TEST_PIT) in ADC_Timers.h since this came in in version V1.4.3.
Also see what happens if SW1 is held down when powering on. This disables the watchdog and you can see whether it hangs after 30s or whether is still resets.

Regards

Mark

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: Demo crashes on Towerkit
« Reply #5 on: March 29, 2011, 11:01:56 PM »
Raf

I can explain the problem:

1) It takes place when the PIT test is operating. The PIT test uses PIT 3 and tests it in single shot mode and then in periodic mode. The orange LED (E2) will flash slowly during the test. After about 30 the timer is disabled. Since the driver seen no more PITs in use it powers down the PIT module.

2) The new performance monitoring (MONITOR_PERFORMANCE) uses PIT 0 to measure the task's operating time.

3) The problem occurs when the PIT test powers down the PIT timer module since then the task monitoring timer is no longer powered up and the code reading it causes an exception.

I propose the solution so that the PIT module is not powered down when it is in use by the performance monitoring.

a) in app_hw_kinetis.h add a define
#define PIT_TIMER_USED_BY_PERFORMANCE_MONITOR                            // since a PIT timer is used for the monitoring function don't allow PITS to be powered down
if MONITOR_PERFORMANCE is being used and a PIT is performing the measurement.
b) in kinetis.c - in the routine fnDisablePIT() disable the power down of the module if it is being used:

// Stop PIT operation and power down when no other activity
//
static void fnDisablePIT(int iPIT)                                                 
{
    KINETIS_PIT_CTL *ptrCtl = (KINETIS_PIT_CTL *)PIT_CTL_ADD;
    ptrCtl += iPIT;
    ptrCtl->PIT_TCTRL = 0;
    ucPITmodes &= ~((PIT_SINGLE_SHOT | PIT_PERIODIC) << (iPIT * 2));
    #if !defined PIT_TIMER_USED_BY_PERFORMANCE_MONITOR                   // don't power the PITs down if one is being used for performance monitoring
    if (ucPITmodes == 0) {
        PIT_MCR = PIT_MCR_MDIS;                                          // disable clocks to module since no more timers are active
        POWER_DOWN(6, SIM_SCGC6_PIT);
    }
    #endif
}

After this change, my kit ran beyond 30s with both active. The orange LED stays on after about 30 since the PIT test has terminated, but this no longer causes a problem with the monitor operation.

Regards

Mark