请教一个头疼的问题。DSP28335 两个通用I/O输出同样的信号。
1、排除硬件的问题,看看是不是焊接短路了。
2、你的配置是怎样的,帖一下程序。
焊接没有短路。两块板都试了。而且,如果把SDO设置为输出,就很正常各输出各的。但是只要设置为输入,就仿佛和CON短路。
#include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
#include "DSP2833x_Examples.h" // DSP2833x Examples Include File
#include "stdio.h"
#define SCK GpioDataRegs.GPADAT.bit.GPIO8 //正常
#define SDO GpioDataRegs.GPADAT.bit.GPIO9 //GPIO 输入
#define SDOUP GpioCtrlRegs.GPAPUD.bit.GPIO9 = 0; //上拉
#define CON_ON GpioDataRegs.GPASET.bit.GPIO10=1; GpioDataRegs.GPACLEAR.bit.GPIO10=0 //置1
#define CON_OFF GpioDataRegs.GPASET.bit.GPIO10=0; GpioDataRegs.GPACLEAR.bit.GPIO10=1 //置0
// interrupt void ISRTimer0(void);
void configtestled(void);
// unsigned char read_1byte_from_adc(void);
void main(void)
{
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP2833x_SysCtrl.c file.
InitSysCtrl();
// Step 2. Initalize GPIO:
// This example function is found in the DSP2833x_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
// InitGpio(); // Skipped for this example
InitXintf16Gpio(); //zq
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;
// Initialize the PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the DSP2833x_PieCtrl.c file.
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in DSP2833x_DefaultIsr.c.
// This function is found in DSP2833x_PieVect.c.
InitPieVectTable();
configtestled();
while(1)
{
SDOUP; //
DELAY_US(1000); //
CON_ON; //最简单的给一个高电平,用示波器观察SDO引脚,发现和CON引脚变化一样.
DELAY_US(1000000);
}
}
void configtestled(void)
{
EALLOW;
GpioCtrlRegs.GPAMUX1.bit.GPIO8 = 0; // sck
GpioCtrlRegs.GPADIR.bit.GPIO8 = 1;
GpioCtrlRegs.GPAMUX1.bit.GPIO9 = 0; // sdo
GpioCtrlRegs.GPADIR.bit.GPIO9 = 0;
GpioCtrlRegs.GPAMUX1.bit.GPIO10 = 0; // con
GpioCtrlRegs.GPADIR.bit.GPIO10 = 1;
EDIS;
}