Other Parts Discussed in Thread: SYSBIOS
Tool/software: TI-RTOS
Hello all,
I have juste started develloping on TivaC123GXL with ti RTOS and I have problem that I hope you have a solution.
I created a task that write on i2c slave and it works fine, after that i created a GPIO interruption on PF4 in order to tell the task to write on i2c slave when the interrupt occure, then I had this message in the CCS console :
waiting for i2c interruption ..
waiting for i2c interruption ..
waiting for i2c interruption ..
waiting for i2c interruption ..
will send
ti.sysbios.family.arm.m3.Hwi: line 1277: E_noIsr: id = 85, pc = 00005a44
Exception occurred in background thread at PC = 0x00005a44.
Core 0: Exception occurred in ThreadType_Task.
Task name: {unknown-instance-name}, handle: 0x20001a10.
Task stack base: 0x20000360.
Task stack size: 0x800.
R0 = 0x00000000 R8 = 0x00000001
R1 = 0x00006d79 R9 = 0x00000008
R2 = 0x20000ab4 R10 = 0x00000008
R3 = 0x00000001 R11 = 0x20001eb0
R4 = 0x20001d60 R12 = 0x00000000
R5 = 0x000000f8 SP(R13) = 0x20000a70
R6 = 0x00000000 LR(R14) = 0x00005a95
R7 = 0x20000ab4 PC(R15) = 0x00005a44
PSR = 0x61000000
ICSR = 0x00423855
MMFSR = 0x00
BFSR = 0x00
UFSR = 0x0000
HFSR = 0x00000000
DFSR = 0x0000000b
MMAR = 0xe000ed34
BFAR = 0xe000ed38
AFSR = 0x00000000
Terminating execution...
the task is waiting for the interrupt, when I occure the interrupt by pushing the user button linked to PF4 the message above occure.
When I tested the interrupt alone by commenting the task, it work fine.
So as conclusion : task alone works fine, interrupt alone works fine but when I use the task and the interrupt i have the message above :
Here is my code :
/*
* Copyright (c) 2015, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* ======== empty_min.c ========
*/
/* XDCtools Header files */
#include <stdbool.h>
#include <xdc/std.h>
/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
/* TI-RTOS Header files */
#include <ti/drivers/GPIO.h>
/* Board Header file */
#include "Board.h"
#include <xdc/runtime/Error.h>
#include <xdc/runtime/System.h>
#include <stdio.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_gpio.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/interrupt.h"
#include <ti/drivers/I2C.h>
#define MY_TASK2_STACK_SIZE 2048
Task_Struct myTask2;
Task_Params myTask2Params;
Char myTask2Stack[MY_TASK2_STACK_SIZE];
int is = 0;
void DRI_vidExtractTouchInfos(void)
{
uint8_t writeBuffer[3];
I2C_Handle handle;
I2C_Params i2cparams;
I2C_Transaction i2c;
I2C_Params_init(&i2cparams);
i2cparams.bitRate = I2C_100kHz;
handle = I2C_open(EK_TM4C123GXL_I2C3, &i2cparams);
if (handle == NULL) {
System_abort("I2C was not opened");
}
while(1)
{
printf("waiting for i2c interruption .. \n");
if(is == 1)
{
i2c.slaveAddress = Board_TPL0401_ADDR;
i2c.readCount = 0;
i2c.readBuf = NULL;
i2c.writeBuf = writeBuffer;
/* Enable the PWM oscillator */
writeBuffer[0] = 0x00;
writeBuffer[1] = 0x81;
i2c.writeCount = 2;
printf("will send \n");
if (!I2C_transfer(handle, &i2c)) {
GPIO_write(Board_LED1, Board_LED_ON);
System_abort("Bad I2C transfer! here");
}
/* Bring the LEDs into PWM mode */
writeBuffer[0] = 0x8C;
writeBuffer[1] = 0xAA;
writeBuffer[2] = 0xAA;
i2c.writeCount = 3;
if (!I2C_transfer(handle, &i2c)) {
GPIO_write(Board_LED1, Board_LED_ON);
System_abort("Bad I2C transfer!");
}
is =0;
}
Task_sleep(100);
}
}
void gpioButtonFxn0(void)
{
/* Clear the GPIO interrupt and toggle an LED */
GPIO_toggle(Board_LED0);
GPIOIntClear(GPIO_PORTF_BASE, GPIO_INT_PIN_4);
is = 1;
}
int main(void)
{
Board_initGeneral();
Board_initGPIO();
Board_initI2C();
//Set the clock to 80Mhz
SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
SysCtlDelay(5);
GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_4);
GPIOPadConfigSet(GPIO_PORTF_BASE,GPIO_PIN_4,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPU);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1);
GPIOIntTypeSet(GPIO_PORTF_BASE,GPIO_PIN_4,GPIO_FALLING_EDGE);
GPIOIntRegister(GPIO_PORTF_BASE,gpioButtonFxn0);
GPIOIntEnable(GPIO_PORTF_BASE, GPIO_INT_PIN_4);
/* this task wait for touch panel event */
Task_Params_init(&myTask2Params);
myTask2Params.stackSize = MY_TASK2_STACK_SIZE;
myTask2Params.stack = &myTask2Stack;
myTask2Params.priority = 3;
Task_construct(&myTask2, (Task_FuncPtr)DRI_vidExtractTouchInfos, &myTask2Params, NULL);
/* Start BIOS */
BIOS_start();
return (0);
}
and here is my memory section configuration :
MEMORY
{
FLASH (RX) : origin = 0x00000000, length = 0x00040000
SRAM (RWX) : origin = 0x20000000, length = 0x00008000
}
/* Section allocation in memory */
SECTIONS
{
.text : > FLASH
.const : > FLASH
.cinit : > FLASH
.pinit : > FLASH
.init_array : > FLASH
.data : > SRAM
.bss : > SRAM
.sysmem : > SRAM
.stack : > SRAM
.vtable : > SRAM
}
Thank you very much for help
Best regards,