小白一枚,我想把蓝牙模块和28377s通过sci串口建立通讯,串口透传模式,利用fifo模式下的查询发,中断收。目前的问题一直收不到,而且发送可能也不对,能帮忙来看看哪里配置不对吗
#include "F28x_Project.h"
void InitscibGpio();
void scib_fifo_init();
void scib_xmit(int c);
void scib_msg(char *msg);
interrupt void ScibRxFIFOIsr(void);
char buffer[100];
char *msg;
Uint16 ReceivePointer;
void InitscibGpio();
void scib_fifo_init();
void scib_xmit(int c);
void scib_msg(char *msg);
interrupt void ScibRxFIFOIsr(void);
char buffer[100];
char *msg;
Uint16 ReceivePointer;
void main(void)
{
InitSysCtrl();
InitGpio();
InitscibGpio();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EALLOW;
PieVectTable.SCIB_RX_INT = &ScibRxFIFOIsr;
EDIS;
scib_fifo_init();
PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
PieCtrlRegs.PIEIER9.bit.INTx3=1;
IER = 0x100;
EINT;
msg="AT:BPS?\r\n";
while(1)
{
scib_msg(msg);
}
{
InitSysCtrl();
InitGpio();
InitscibGpio();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EALLOW;
PieVectTable.SCIB_RX_INT = &ScibRxFIFOIsr;
EDIS;
scib_fifo_init();
PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
PieCtrlRegs.PIEIER9.bit.INTx3=1;
IER = 0x100;
EINT;
msg="AT:BPS?\r\n";
while(1)
{
scib_msg(msg);
}
}
void InitscibGpio() //初始化GPIO管脚
{
EALLOW;
void InitscibGpio() //初始化GPIO管脚
{
EALLOW;
GpioCtrlRegs.GPAPUD.bit.GPIO18 = 0;
GpioCtrlRegs.GPAPUD.bit.GPIO19 = 0;
GpioCtrlRegs.GPAPUD.bit.GPIO19 = 0;
GpioCtrlRegs.GPAQSEL2.bit.GPIO19 = 3;
GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 2;
GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 2;
GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 2;
GpioCtrlRegs.GPAGMUX2.bit.GPIO18 = 0;
GpioCtrlRegs.GPAGMUX2.bit.GPIO19 = 0;
GpioCtrlRegs.GPAGMUX2.bit.GPIO19 = 0;
EDIS;
}
void scib_fifo_init()
{
ScibRegs.SCICCR.all =0x0007; // 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
ScibRegs.SCICTL1.all =0x0003;// enable TX, RX, internal sciaLK,
// Disable RX ERR, SLEEP, TXWAKE
ScibRegs.SCICTL2.bit.RXBKINTENA =1;//接收中断使能
ScibRegs.SCIHBAUD.all = 0x0000; // 115200 baud @LSPCLK = 50MHz.
ScibRegs.SCILBAUD.all = 0x0035;
ScibRegs.SCIFFTX.all=0xE040;
ScibRegs.SCIFFRX.all=0x0062;
ScibRegs.SCIFFCT.all=0x00;
ScibRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset
ScibRegs.SCIFFTX.bit.TXFIFORESET=1;
ScibRegs.SCIFFRX.bit.RXFIFORESET=1;
}
}
void scib_fifo_init()
{
ScibRegs.SCICCR.all =0x0007; // 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
ScibRegs.SCICTL1.all =0x0003;// enable TX, RX, internal sciaLK,
// Disable RX ERR, SLEEP, TXWAKE
ScibRegs.SCICTL2.bit.RXBKINTENA =1;//接收中断使能
ScibRegs.SCIHBAUD.all = 0x0000; // 115200 baud @LSPCLK = 50MHz.
ScibRegs.SCILBAUD.all = 0x0035;
ScibRegs.SCIFFTX.all=0xE040;
ScibRegs.SCIFFRX.all=0x0062;
ScibRegs.SCIFFCT.all=0x00;
ScibRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset
ScibRegs.SCIFFTX.bit.TXFIFORESET=1;
ScibRegs.SCIFFRX.bit.RXFIFORESET=1;
}
void scib_xmit(int c)
{
while(ScibRegs.SCIFFTX.bit.TXFFST >= 15){}
ScibRegs.SCITXBUF.all = c;
}
void scib_msg(char *msg)
{
int i;
i = 0;
while( msg[i]!='\0')
{
scib_xmit(msg[i]);
i++;
}
}
interrupt void ScibRxFIFOIsr(void)
{
ReceivePointer = 0;
while(ScibRegs.SCIFFRX.bit.RXFFST)
{
buffer[ReceivePointer++] = ScibRegs.SCIRXBUF.all;
}
ScibRegs.SCIFFRX.bit.RXFFOVRCLR=1; // Clear Overflow flag
ScibRegs.SCIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag
{
while(ScibRegs.SCIFFTX.bit.TXFFST >= 15){}
ScibRegs.SCITXBUF.all = c;
}
void scib_msg(char *msg)
{
int i;
i = 0;
while( msg[i]!='\0')
{
scib_xmit(msg[i]);
i++;
}
}
interrupt void ScibRxFIFOIsr(void)
{
ReceivePointer = 0;
while(ScibRegs.SCIFFRX.bit.RXFFST)
{
buffer[ReceivePointer++] = ScibRegs.SCIRXBUF.all;
}
ScibRegs.SCIFFRX.bit.RXFFOVRCLR=1; // Clear Overflow flag
ScibRegs.SCIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100;
}
}
mangui zhang:先基于controlsuite下的例子跑通实现上位机串口调试助手的正常收发然后再和模块连调
小白一枚,我想把蓝牙模块和28377s通过sci串口建立通讯,串口透传模式,利用fifo模式下的查询发,中断收。目前的问题一直收不到,而且发送可能也不对,能帮忙来看看哪里配置不对吗
#include "F28x_Project.h"
void InitscibGpio();
void scib_fifo_init();
void scib_xmit(int c);
void scib_msg(char *msg);
interrupt void ScibRxFIFOIsr(void);
char buffer[100];
char *msg;
Uint16 ReceivePointer;
void InitscibGpio();
void scib_fifo_init();
void scib_xmit(int c);
void scib_msg(char *msg);
interrupt void ScibRxFIFOIsr(void);
char buffer[100];
char *msg;
Uint16 ReceivePointer;
void main(void)
{
InitSysCtrl();
InitGpio();
InitscibGpio();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EALLOW;
PieVectTable.SCIB_RX_INT = &ScibRxFIFOIsr;
EDIS;
scib_fifo_init();
PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
PieCtrlRegs.PIEIER9.bit.INTx3=1;
IER = 0x100;
EINT;
msg="AT:BPS?\r\n";
while(1)
{
scib_msg(msg);
}
{
InitSysCtrl();
InitGpio();
InitscibGpio();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EALLOW;
PieVectTable.SCIB_RX_INT = &ScibRxFIFOIsr;
EDIS;
scib_fifo_init();
PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
PieCtrlRegs.PIEIER9.bit.INTx3=1;
IER = 0x100;
EINT;
msg="AT:BPS?\r\n";
while(1)
{
scib_msg(msg);
}
}
void InitscibGpio() //初始化GPIO管脚
{
EALLOW;
void InitscibGpio() //初始化GPIO管脚
{
EALLOW;
GpioCtrlRegs.GPAPUD.bit.GPIO18 = 0;
GpioCtrlRegs.GPAPUD.bit.GPIO19 = 0;
GpioCtrlRegs.GPAPUD.bit.GPIO19 = 0;
GpioCtrlRegs.GPAQSEL2.bit.GPIO19 = 3;
GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 2;
GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 2;
GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 2;
GpioCtrlRegs.GPAGMUX2.bit.GPIO18 = 0;
GpioCtrlRegs.GPAGMUX2.bit.GPIO19 = 0;
GpioCtrlRegs.GPAGMUX2.bit.GPIO19 = 0;
EDIS;
}
void scib_fifo_init()
{
ScibRegs.SCICCR.all =0x0007; // 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
ScibRegs.SCICTL1.all =0x0003;// enable TX, RX, internal sciaLK,
// Disable RX ERR, SLEEP, TXWAKE
ScibRegs.SCICTL2.bit.RXBKINTENA =1;//接收中断使能
ScibRegs.SCIHBAUD.all = 0x0000; // 115200 baud @LSPCLK = 50MHz.
ScibRegs.SCILBAUD.all = 0x0035;
ScibRegs.SCIFFTX.all=0xE040;
ScibRegs.SCIFFRX.all=0x0062;
ScibRegs.SCIFFCT.all=0x00;
ScibRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset
ScibRegs.SCIFFTX.bit.TXFIFORESET=1;
ScibRegs.SCIFFRX.bit.RXFIFORESET=1;
}
}
void scib_fifo_init()
{
ScibRegs.SCICCR.all =0x0007; // 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
ScibRegs.SCICTL1.all =0x0003;// enable TX, RX, internal sciaLK,
// Disable RX ERR, SLEEP, TXWAKE
ScibRegs.SCICTL2.bit.RXBKINTENA =1;//接收中断使能
ScibRegs.SCIHBAUD.all = 0x0000; // 115200 baud @LSPCLK = 50MHz.
ScibRegs.SCILBAUD.all = 0x0035;
ScibRegs.SCIFFTX.all=0xE040;
ScibRegs.SCIFFRX.all=0x0062;
ScibRegs.SCIFFCT.all=0x00;
ScibRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset
ScibRegs.SCIFFTX.bit.TXFIFORESET=1;
ScibRegs.SCIFFRX.bit.RXFIFORESET=1;
}
void scib_xmit(int c)
{
while(ScibRegs.SCIFFTX.bit.TXFFST >= 15){}
ScibRegs.SCITXBUF.all = c;
}
void scib_msg(char *msg)
{
int i;
i = 0;
while( msg[i]!='\0')
{
scib_xmit(msg[i]);
i++;
}
}
interrupt void ScibRxFIFOIsr(void)
{
ReceivePointer = 0;
while(ScibRegs.SCIFFRX.bit.RXFFST)
{
buffer[ReceivePointer++] = ScibRegs.SCIRXBUF.all;
}
ScibRegs.SCIFFRX.bit.RXFFOVRCLR=1; // Clear Overflow flag
ScibRegs.SCIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag
{
while(ScibRegs.SCIFFTX.bit.TXFFST >= 15){}
ScibRegs.SCITXBUF.all = c;
}
void scib_msg(char *msg)
{
int i;
i = 0;
while( msg[i]!='\0')
{
scib_xmit(msg[i]);
i++;
}
}
interrupt void ScibRxFIFOIsr(void)
{
ReceivePointer = 0;
while(ScibRegs.SCIFFRX.bit.RXFFST)
{
buffer[ReceivePointer++] = ScibRegs.SCIRXBUF.all;
}
ScibRegs.SCIFFRX.bit.RXFFOVRCLR=1; // Clear Overflow flag
ScibRegs.SCIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100;
}
}
Jingyuan Zhao:
您好,请问您使用的是自己开发的电路板还是lanchpad? 您也以先用usb转串口测试一下SCI B的输入输出
小白一枚,我想把蓝牙模块和28377s通过sci串口建立通讯,串口透传模式,利用fifo模式下的查询发,中断收。目前的问题一直收不到,而且发送可能也不对,能帮忙来看看哪里配置不对吗
#include "F28x_Project.h"
void InitscibGpio();
void scib_fifo_init();
void scib_xmit(int c);
void scib_msg(char *msg);
interrupt void ScibRxFIFOIsr(void);
char buffer[100];
char *msg;
Uint16 ReceivePointer;
void InitscibGpio();
void scib_fifo_init();
void scib_xmit(int c);
void scib_msg(char *msg);
interrupt void ScibRxFIFOIsr(void);
char buffer[100];
char *msg;
Uint16 ReceivePointer;
void main(void)
{
InitSysCtrl();
InitGpio();
InitscibGpio();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EALLOW;
PieVectTable.SCIB_RX_INT = &ScibRxFIFOIsr;
EDIS;
scib_fifo_init();
PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
PieCtrlRegs.PIEIER9.bit.INTx3=1;
IER = 0x100;
EINT;
msg="AT:BPS?\r\n";
while(1)
{
scib_msg(msg);
}
{
InitSysCtrl();
InitGpio();
InitscibGpio();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EALLOW;
PieVectTable.SCIB_RX_INT = &ScibRxFIFOIsr;
EDIS;
scib_fifo_init();
PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
PieCtrlRegs.PIEIER9.bit.INTx3=1;
IER = 0x100;
EINT;
msg="AT:BPS?\r\n";
while(1)
{
scib_msg(msg);
}
}
void InitscibGpio() //初始化GPIO管脚
{
EALLOW;
void InitscibGpio() //初始化GPIO管脚
{
EALLOW;
GpioCtrlRegs.GPAPUD.bit.GPIO18 = 0;
GpioCtrlRegs.GPAPUD.bit.GPIO19 = 0;
GpioCtrlRegs.GPAPUD.bit.GPIO19 = 0;
GpioCtrlRegs.GPAQSEL2.bit.GPIO19 = 3;
GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 2;
GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 2;
GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 2;
GpioCtrlRegs.GPAGMUX2.bit.GPIO18 = 0;
GpioCtrlRegs.GPAGMUX2.bit.GPIO19 = 0;
GpioCtrlRegs.GPAGMUX2.bit.GPIO19 = 0;
EDIS;
}
void scib_fifo_init()
{
ScibRegs.SCICCR.all =0x0007; // 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
ScibRegs.SCICTL1.all =0x0003;// enable TX, RX, internal sciaLK,
// Disable RX ERR, SLEEP, TXWAKE
ScibRegs.SCICTL2.bit.RXBKINTENA =1;//接收中断使能
ScibRegs.SCIHBAUD.all = 0x0000; // 115200 baud @LSPCLK = 50MHz.
ScibRegs.SCILBAUD.all = 0x0035;
ScibRegs.SCIFFTX.all=0xE040;
ScibRegs.SCIFFRX.all=0x0062;
ScibRegs.SCIFFCT.all=0x00;
ScibRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset
ScibRegs.SCIFFTX.bit.TXFIFORESET=1;
ScibRegs.SCIFFRX.bit.RXFIFORESET=1;
}
}
void scib_fifo_init()
{
ScibRegs.SCICCR.all =0x0007; // 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
ScibRegs.SCICTL1.all =0x0003;// enable TX, RX, internal sciaLK,
// Disable RX ERR, SLEEP, TXWAKE
ScibRegs.SCICTL2.bit.RXBKINTENA =1;//接收中断使能
ScibRegs.SCIHBAUD.all = 0x0000; // 115200 baud @LSPCLK = 50MHz.
ScibRegs.SCILBAUD.all = 0x0035;
ScibRegs.SCIFFTX.all=0xE040;
ScibRegs.SCIFFRX.all=0x0062;
ScibRegs.SCIFFCT.all=0x00;
ScibRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset
ScibRegs.SCIFFTX.bit.TXFIFORESET=1;
ScibRegs.SCIFFRX.bit.RXFIFORESET=1;
}
void scib_xmit(int c)
{
while(ScibRegs.SCIFFTX.bit.TXFFST >= 15){}
ScibRegs.SCITXBUF.all = c;
}
void scib_msg(char *msg)
{
int i;
i = 0;
while( msg[i]!='\0')
{
scib_xmit(msg[i]);
i++;
}
}
interrupt void ScibRxFIFOIsr(void)
{
ReceivePointer = 0;
while(ScibRegs.SCIFFRX.bit.RXFFST)
{
buffer[ReceivePointer++] = ScibRegs.SCIRXBUF.all;
}
ScibRegs.SCIFFRX.bit.RXFFOVRCLR=1; // Clear Overflow flag
ScibRegs.SCIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag
{
while(ScibRegs.SCIFFTX.bit.TXFFST >= 15){}
ScibRegs.SCITXBUF.all = c;
}
void scib_msg(char *msg)
{
int i;
i = 0;
while( msg[i]!='\0')
{
scib_xmit(msg[i]);
i++;
}
}
interrupt void ScibRxFIFOIsr(void)
{
ReceivePointer = 0;
while(ScibRegs.SCIFFRX.bit.RXFFST)
{
buffer[ReceivePointer++] = ScibRegs.SCIRXBUF.all;
}
ScibRegs.SCIFFRX.bit.RXFFOVRCLR=1; // Clear Overflow flag
ScibRegs.SCIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100;
}
}
Jordan Zhou:定义的message和发送的结束标志不一样,修改为msg="AT:BPS?\r\n\0";
msg="AT:BPS?\r\n";
while( msg[i]!='\0')