This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

F28M35 PB7 输出问题



F28M35的PB7引脚输出一直是高,不知道为什么。

上图中粉色是PB6,绿色PB7.复位后PB7仍然是输出高

具体代码如下:

/*
* main.c
*/

#include "inc/hw_sysctl.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_nvic.h"
#include "inc/hw_types.h"
#include "inc/hw_gpio.h"
#include "inc/hw_ipc.h"
#include "board_drivers/set_pinout_f28m35x.h"
#include "driverlib/ipc.h"
#include "driverlib/sysctl.h"
#include "driverlib/interrupt.h"
#include "driverlib/debug.h"
#include "driverlib/cpu.c"
#include "driverlib/gpio.h"
#include "can.h"
#include "driverlib/timer.h"


volatile unsigned long ulLoop;
unsigned int loop;
unsigned long sysclk;

// Interrupt
void Timer0Handler(void)
{
static unsigned int toggle = 0;

TimerIntClear(TIMER0_BASE,TIMER_TIMA_TIMEOUT);

if(toggle == 0)
{
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_5, 0);
GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_6, 0);
GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_7, 0);
GPIOPinWrite(GPIO_PORTH_BASE, GPIO_PIN_4, 0);
toggle = 1;
}
else
{
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_5, ~0);
GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_6, ~0);
GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_7, ~0);
GPIOPinWrite(GPIO_PORTH_BASE, GPIO_PIN_4, ~0);
toggle = 0;
}

loop++;
}

int main(void)
{
// Allow writes to protected registers.
HWREG(SYSCTL_MWRALLOW) = 0xA5A5A5A5;

// Sets up PLL, M3 running at 100MHz and C28 running at 150MHz
SysCtlClockConfigSet(SYSCTL_USE_PLL | (SYSCTL_SPLLIMULT_M & 0xA) |
SYSCTL_SYSDIV_1 | SYSCTL_M3SSDIV_1 |
SYSCTL_XCLKDIV_4);

// Enable all GPIOs
//PinoutSet();

can0Init();

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);

SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);

// Disable clock supply for the watchdog modules
SysCtlPeripheralDisable(SYSCTL_PERIPH_WDOG1);
SysCtlPeripheralDisable(SYSCTL_PERIPH_WDOG0);

TimerConfigure(TIMER0_BASE, TIMER_CFG_32_BIT_PER);
TimerLoadSet(TIMER0_BASE,TIMER_A,SysCtlClockGet(SYSTEM_CLOCK_SPEED)/1);//Period = Sys_ctl/1 / F_clk

IntEnable(INT_TIMER0A);
TimerIntEnable(TIMER0_BASE,TIMER_TIMA_TIMEOUT);
IntRegister(INT_TIMER0A,Timer0Handler);

TimerEnable(TIMER0_BASE,TIMER_A);

sysclk = SysCtlClockGet(SYSTEM_CLOCK_SPEED);

// Enable processor interrupts.
IntMasterEnable();

// Set up the Pin for LED6
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_6);
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6, ~0);

// LED5
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_5);
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_5, ~0);


GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_7);
GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_7, ~0);

GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_6);
GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_6, ~0);

GPIOPinTypeGPIOOutput(GPIO_PORTH_BASE,GPIO_PIN_4);
GPIOPinWrite(GPIO_PORTH_BASE, GPIO_PIN_4, ~0);

// Loop forever while the timers run.
while(1)
{

}

}