请教一个头疼的问题。DSP28335 两个通用I/O输出同样的信号。

2019-07-15 19:17发布

使用的 GPIO8 为 SCK信号(输出),GPIO9为SDA(输入),GPIO10 为 CON(输出)。SCK信号正常。用示波器测试发现 SDA和CON信号完全相同,就像连在一起一样。就算把SDA所有的语句注释掉,依然和CON信号一样。刚开始使用 GPADAT寄存器 直接赋值0或1,不行。后来使用GPASET和clear寄存器,还是信号相同。我有两块一样的电路板,刚开始运行一次两次还正常,之后程序没有改动再运行就出现上面的情况,两块板都是。

QQ图片20160430182439.png
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
2条回答
愤怒喵星人
2019-07-16 00:30
本帖最后由 愤怒喵星人 于 2016-4-30 21:42 编辑

焊接没有短路。两块板都试了。而且,如果把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;
}


一周热门 更多>