AnsweredAssumed Answered

Touch software 2.0 for kinetis implementation problems

Question asked by Guillermo Martinez on Dec 28, 2016
Latest reply on Feb 13, 2017 by Guillermo Martinez

Hello everyone,

 

I would like to implement the new touch software for kinetis (v 2.0). I have added all the files into my project and I have no errors but when I'm debugging there is a fail initialization.

 

The code that I have been using is similar to the example which appears in the notes and is the following:

 

static void keypad_callback(const struct nt_control *control,enum nt_control_keypad_event event,uint32_t index);

static void APP_triggerElectrodeScan (
void *pParam1,
void *pParam2
);

uint8_t nt_memory_pool[1024] __attribute__((aligned (4))); /* Keil, GCC compiler */

 

void APP_TSI_init (void)
{
int32_t result;
SCH_TIME_T tsiTriggerPeriod;
SCH_JOB_ACTION_T tsiTriggerAction;

/* Electrodes */
CLOCK_EnableClock(kCLOCK_PortB); /* Ungate the port E clock */
PORT_SetPinMux(PORTB, 0U,kPORT_PinDisabledOrAnalog); /* PTB18 TSI0 channel 11 */
PORT_SetPinMux(PORTB, 1U, kPORT_PinDisabledOrAnalog); /* PTB3 TSI0 channel 8 */
PORT_SetPinMux(PORTB, 2U, kPORT_PinDisabledOrAnalog); /* PTB2 TSI0 channel 7 */
PORT_SetPinMux(PORTB, 3U, kPORT_PinDisabledOrAnalog); /* PTB1 TSI0 channel 6 */
PORT_SetPinMux(PORTB, 18U, kPORT_PinDisabledOrAnalog); /* PTB0 TSI0 channel 0 */

 

if ((result = nt_init(&system_0, nt_memory_pool, sizeof(nt_memory_pool))) != NT_SUCCESS)
{
switch(result)
{
case NT_FAILURE:
result=1;
break;
case NT_OUT_OF_MEMORY:
result=2;
break;
}
while(1); /* add code to handle this error */
}

nt_mem_get_free_size());

nt_electrode_enable(&electrode_0, 0);

 

nt_module_recalibrate(&tsi_module, NULL);
nt_control_enable(&keypad_0);
nt_control_keypad_register_callback(&keypad_0, &keypad_callback);

/* Trigger scan every 5ms */
tsiTriggerPeriod.value = 5;
tsiTriggerPeriod.unit = SCH_TIME_UNIT_MSEC;

tsiTriggerAction.pfAction = APP_triggerElectrodeScan;
tsiTriggerAction.pParam1 = NULL;
tsiTriggerAction.pParam2 = NULL;

SCH_addJobHB(&tsiTriggerPeriod, BOOL_TRUE, &tsiTriggerAction);

}

 

I have been debugging step by step and I have some problem in nt_init, specially in _nt_mem_init function in:

 

if(system->memory.pool != NULL)
{
return NT_FAILURE;
}

 

and then I have some problems in nt_system_init in 

 

if(nt_kernel_data.modules == NULL)
{
return NT_OUT_OF_MEMORY;
}

 

Anyone has any idea about this problem?

Outcomes