Home > Blockchain >  Can't configure Tiva C with Tivaware Drivers
Can't configure Tiva C with Tivaware Drivers

Time:01-03

I am trying to use Tivaware Drivers for the first time with Tiva C TM4C123GH6PM.

I read the System Control driver and GPIO driver to know which API I want for my Program.

I am trying to configure the clock to use main clock of the system, then enable (PORT A, Pin 7) to use the RED LED Attached to it.

But the code is not working.

Please help me.

#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_memmap.h"
#include "driverlib/gpio.h"
#include "driverlib/sysctl.h"

int main(void) {
    //Configure Clock
    SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN);

    //Enable Port A
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

    while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOA));

    //Pin 7 as Output
    GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_7);

    //LED HIGH
    GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_7, 0x80);

    while(1){


    }
 }

CodePudding user response:

First, use one of the sample applications (examples/bilinky) by following the steps specified in the document I shared in the references section; in this way, you will have tested both the hardware and the software. You will see that properties such as port clock configuration are defined in the startup_css.c file; take the data in this file as an example, as these types of features are common to development boards.


References
  • Related