Jump to content
Forum sending old emails Read more... ×

frankiboy

Members
  • Content Count

    2
  • Joined

  • Last visited

  1. frankiboy

    Unable to use Port E for GPIO

    Answering my own question since I found the solution. It was simple as expected, so I don't know why I didn't see this from the beginning. I need to enable the peripheral before I start using it. Adding the following line before setting the pin as input solved the problem: ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); I assume Port A and F did not cause the same issue since the ports where in use by the driverlib/utils code.
  2. frankiboy

    Unable to use Port E for GPIO

    Hi, Quite new to this forum and the Stellaris launchpad. I've faced a problem and not found any answers after hours of searching. I feel pretty stupid about this one, since it should be very basic. I've set up gcc on my linux desktop and have been able to run several examples and tested some of my own code without any problems. I want to do some temperature readings using a DS18B20 temperature sensor. I soldered a temperature sensor to PE4. The problem I face is that everything seems to hang once I set PE4 as GPIO input. I've stripped down my code to make it easier to debug, please have a look. #include "inc/hw_gpio.h" #include "inc/hw_memmap.h" #include "inc/hw_sysctl.h" #include "inc/hw_types.h" #include "driverlib/gpio.h" #include "driverlib/rom.h" #include "driverlib/sysctl.h" #include "utils/uartstdio.h" #define BLINK #define LED_RED GPIO_PIN_1 #define LED_BLUE GPIO_PIN_2 #define LED_GREEN GPIO_PIN_3 #define DELAY_MS(ms) {ROM_SysCtlDelay(ms * (ROM_SysCtlClockGet() / 3000));} #define DELAY_US(us) {ROM_SysCtlDelay(us * ((ROM_SysCtlClockGet() / 3000)/1000));} static char uart_input_buffer[128]; int main() { ROM_SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); ROM_GPIOPinConfigure(GPIO_PA0_U0RX); ROM_GPIOPinConfigure(GPIO_PA1_U0TX); ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); UARTStdioInit(0); UARTEchoSet(false); ROM_GPIOPinTypeGPIOInput(GPIO_PORTE_BASE, GPIO_PIN_4); ROM_IntMasterEnable(); UARTprintf("Welcome.\n"); UARTprintf(". . . . . . . . . . . . . . ."); for (; { #ifdef BLINK ROM_GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_GREEN|LED_BLUE, LED_BLUE|LED_RED); DELAY_MS(1000); ROM_GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_GREEN|LED_BLUE, LED_RED); DELAY_MS(1000); ROM_GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_GREEN|LED_BLUE, LED_GREEN); DELAY_MS(1000); #else ROM_GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_GREEN|LED_BLUE, 0); #endif } } The system seems to hang when I run this code. There is no output on the uart and the light is not blinking. If I remove the following line ROM_GPIOPinTypeGPIOInput(GPIO_PORTE_BASE, GPIO_PIN_4); everything is as expected. It looks like the same happens if I try to use any pin on port E or B, while port A and F works as expected. Any idea why this is not working? Thanks!
×