Other Parts Discussed in Thread: TM4C1294NCPDT
Hello Team,
I'm using EK-TM4C1294XL launchpad as a beginner i have started writing a sample code which blinks LED(PN0) whenever USR_SW1(PJ0) is pressed.
I have included diverlib provided by TI and also i have added ti\TivaWare_C directory path to #include search path(--include_path, -I)
1) When i run the below code it is going to Fault_ISR() at GPIODirModeSet() and MAP_GPIOPadConfigSet(). whenever writing a code using TI library it is happening like this? did i miss any include files? Please help me to solve this issue.
#include <stdio.h> #include <stdbool.h> #include <stdint.h> #include "inc/hw_gpio.h" #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/gpio.h" #include "driverlib/pin_map.h" #include "driverlib/rom.h" #include "driverlib/rom_map.h" #include "driverlib/sysctl.h" #include "driverlib/systick.h" int main(void) { uint32_t value = 0; uint8_t state = 0; volatile uint32_t ui32Loop; // // Enable the GPIO port that is used for the on-board LED. // SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION); // // Check if the peripheral access is enabled. // while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPION)) { } GPIODirModeSet (GPIO_PORTJ_BASE, GPIO_PIN_0, GPIO_DIR_MODE_IN); MAP_GPIOPadConfigSet (GPIO_PORTJ_BASE, GPIO_PIN_0, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); // // Enable the GPIO pin for the LED (PN0). Set the direction as output, and // enable the GPIO pin for digital function. // GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0); // // Loop forever. // while(1) { value = GPIOPinRead(GPIO_PORTJ_BASE, GPIO_PIN_0); if((value & GPIO_PIN_0) == 0)
state ^= GPIO_PIN_1; // // Turn on the LED. // GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, state); // // Delay for a bit. // for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++) { } } }