K60, UART and Low Power Interrupt enabled, but UART not responding to fopen - help!

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

K60, UART and Low Power Interrupt enabled, but UART not responding to fopen - help!

2,327 Views
brianpaterson
Contributor III

Hi - this problem may be answered elsewhere, but I'm totally stumped.


Before I enabled the low power modes....I had the ittyb channel open and functional - so I can read and write data at 19200 baud to the external device.

Now, I need to set the sleep or low power modes so that the battery doesn't die on me.

Oh yes - I read the issues with the ittyd and ittyf - but they are enabled and used - ittyf for the debugging and ittyd for my GPS (read only)

I'm using the K60_1M0_120 144pin device.

Software is Keil 4.0.2.2 and as I had issues with the conflict on the low power/serial before, it is a clean install.


From the user_config.h, as well as the ittyb, d, f being enabled,are the following and I wonder if there is a conflict:

#define BSPCFG_ENABLE_FLASHX 0
#define BSPCFG_ENABLE_ESDHC  1
#define BSPCFG_ENABLE_IODEBUG1

#define BSPCFG_ENABLE_NANDFLASH  1

#define BSPCFG_ENABLE_USBDCD 0
#define BSPCFG_ENABLE_CRC    0
#define BSPCFG_HAS_SRAM_POOL 1
#define BSPCFG_ENET_SRAM_BUF 1
#define MQX_USE_IDLE_TASK           1
#define MQX_ENABLE_LOW_POWER        1
#define MQXCFG_ENABLE_FP            1

#define MQX_INCLUDE_FLOATING_POINT_IO   1

#define MQX_TASK_DESTRUCTION 1
#define MQX_USE_TIMER   1
#define SHELLCFG_USES_MFS   1

#define BSPCFG_ENABLE_IO_SUBSYSTEM    1

#define MQX_USE_SEMAPHORES   1
#define MQX_HAS_TIME_SLICE   1
#define MQX_USE_LOGS   1

#define BSP_DEFAULT_IO_CHANNEL_DEFINED

#define BSP_DEFAULT_IO_CHANNEL "ttyf:"

#define USBCLASS_INC_PRINTER

#define BSPCFG_ENABLE_ADC   1
#define BSPCFG_ENABLE_LWADC    1

#define BSP_ADC_POTENTIOMETER 

From my code:

    fh_ptr = uart_init(19200,"ittyb:");

which calls:

   fd = (pointer)fopen(device, BSP_DEFAULT_IO_OPEN_MODE);

and totally locks in the SER_INT.C routine at line 294:

     (*int_io_dev_ptr->DEV_IOCTL)(int_io_dev_ptr->DEV_INFO_PTR, IO_IOCTL_SERIAL_SET_FLAGS, &ioctl_val);

It runs into either the mqx idle routine or I've caught it in some assembler code looking at the interrupt structure, which appears empty???

The low power mode just before the lock-up is "LPM_OPERATIONAL_MODE_RUN".

I'm locking an interrupt somewhere, but I cannot figure out which one or how to discover the held link for myself.

Any thought would be appreciated!

Brian

P.S. - I just saw the default device as "ttyf:". I'll fix it....

Labels (1)
0 Kudos
3 Replies

853 Views
brianpaterson
Contributor III

I think I found it:

Re: Set MQX_ENABLE_LOW_POWER make ittya does not work?

Setting all channels to have the correct mode during whatever power state is interesting, hope I got it correct.

I recompiled bsp with the suggested settings to init_sci.c and the "fopen" returns an address. Cool.

I don't have the full development suite here, but this looks promising at least.

OK, why did the code fail?

Any other ideas are more than welcome!

0 Kudos

852 Views
soledad
NXP Employee
NXP Employee

Hi,

There are two important application notes to study:

AN4447 about Freescale MQX Low Power Manager driver (http://cache.freescale.com/files/32bit/doc/app_note/AN4447.pdf) and AN4503 about Power Management on Kinetis in general (http://cache.freescale.com/files/32bit/doc/app_note/AN4503.pdf)

and also information given about low power chip behavior in the Reference Manual for the respective chip.

Please check the MQX 4.0 source code files. In these files you can find an example that was modified the out of box lowpower demo in such a way that the code cause the chip to transition RUN->VLPS and wakeup and transition VLPS->RUN via UART5_RXD active edge interrupt.

c:\Freescale\Freescale_MQX_4_0\mqx\examples\lowpower\main.c

This was tested on the TWR-K60F120M with TWR-SER.

Notice you need to test standalone the example (not in debug mode).

I hope this helps 

Regards

Sol


-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

852 Views
brianpaterson
Contributor III

soledad,

Thanks for the response and you've also hit on some of what I found previously.

I also had a problem, I found later on, with the KEIL compiler and the change from MQX 3.8 to 4.0.

Keil issued a temporary "fix" to allow the 3.8-compatible KEIL compiler to be used with the new 4.0 code. It re-arranged some files...

When I placed 4.0.2.2 on top, the entire system crashed. Totally re-installing 4.0.2 and migrating to 4.0.2.2 allowed me to get to the current version, solving several problems.

Anyway, back to the problem at hand - ittyb:

May I respectfully suggest that you recompile the user_config.h and enable ittyb:.

Then, write some code to open the port. I suspect you'll lock up as I did. (actually, an unserviced interrupt leading to endless wait-state)

Problem is the init_sci.c - all the other ports are turned OFF when the user_config.h has the MQX_ENABLE LOW_POWER set to 1.

Only certain ports (like "F") are left enabled.

I altered the ports in init_sci.c as follows (for example, each sci 0 to 5, sleep)

/* LPM_OPERATION_MODE_SLEEP */
{
    IO_PERIPHERAL_PIN_MUX_ENABLE | IO_PERIPHERAL_CLOCK_ENABLE | IO_PERIPHERAL_MODULE_ENABLE | IO_PERIPHERAL_WAKEUP_ENABLE | IO_PERIPHERAL_WAKEUP_SLEEPONEXIT_DISABLE,
    0,
    0,
    0
},

I altered the wait, sleep and stop modes for each sci.

Kindly advise me on what you find!

Thanks!

Brian

0 Kudos