I hope to explain in the best way.
sending several data 15 frames in total. Sending a frame several times and hope that confirmation has arrived correctly to send the next, so on to send the 15 frames.
I present the problem is that at some point, stop listening to the rx interruptions confirms that I came plot correctly so send the next. It takes recuchar or definitely not listening. I do not know why this happens. the channel may be filled but not how correct this.
I share the code I'm using
I hope you can help me.
#include "DSP28x_Project.h" // Device Headerfile and Examples Include File
void scia_init(void);
void scib_init(void);// configura SCIB para recibir
void scib_xmit(void);// funcion de recibir
void inicializa(void);
void divideval(int);
void divideval2(int);
void divideval3(int);
void divideval4(int);
void divideval5(int);
void divideval6(int);
void divideval7(int);
void divideval8(int);
void divideval9(int);
void divideval10(int);
void divideval11(int);
void divideval12(int);
void divideval13(int);
void divideval14(int);
void divideval15(int);
void tx_envia(char[]);
void rx_recibe(void);
void loop(void);
__interrupt void rxbint_isr(void);
__interrupt void cpu_timer0_isr(void);
Uint32 p=0;
//char tx_buff[16];
void tiempo(void);// funcion de tiempo
int sec=0;
double v1=5.989189;
Uint16 dato;
Uint16 recibido=0;
int j=0;
void main(void)
{
InitSysCtrl();
InitSciaGpio();
InitScibGpio();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
//InitAdc();
EALLOW;
PieVectTable.SCIRXINTB=&rxbint_isr;
PieVectTable.TINT0 = &cpu_timer0_isr;
EDIS; // This is needed to disable write to EALLOW protected registers
InitCpuTimers(); // For this example, only initialize the Cpu Timers
ConfigCpuTimer(&CpuTimer0, 150, 1000000);
CpuTimer0Regs.TCR.all = 0x4000; // Use write-only instruction to set TSS bit = 0
IER |= M_INT1;
IER |=0x0100; // interrupcion RX
PieCtrlRegs.PIEIER9.bit.INTx3=1; // habilita interrupcion RX
PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
// Enable global Interrupts and higher priority real-time debug events:
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
scib_init();
inicializa();
// scia_init();
// Step 6. IDLE loop. Just sit and loop forever (optional):
for(;;);
}
// configuraciones
void scib_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 SCICLK,
// Disable RX ERR, SLEEP, TXWAKE
ScibRegs.SCICTL2.all =0x0003;
ScibRegs.SCICTL2.bit.RXBKINTENA = 1;
ScibRegs.SCICTL2.bit.TXINTENA = 1;
ScibRegs.SCIHBAUD =0x0001;
ScibRegs.SCILBAUD =0x00E7;
ScibRegs.SCIFFRX.all=0x0022;
ScibRegs.SCIFFCT.all=0x0000;
ScibRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset
//ScibRegs.SCIFFRX.all=0x204f;
ScibRegs.SCIFFCT.all=0x0;
ScibRegs.SCIFFTX.all=0xE040;
//ScibRegs.SCIFFTX.bit.TXFIFOXRESET=1;
ScibRegs.SCIFFRX.bit.RXFIFORESET=1;
}
__interrupt void rxbint_isr(void)
{
recibido = ScibRegs.SCIRXBUF.all;
PieCtrlRegs.PIEACK.all|=0x100;
ScibRegs.SCIFFRX.bit.RXFFINTCLR=1;
//PieCtrlRegs.PIEIER1.bit.INTx7 = 1; // habilita interrupcion timer0
}
// funciones
void inicializa(void)
{
recibido=0;
dato=v1*100;
divideval(dato);
}
__interrupt void cpu_timer0_isr(void)
{
sec=CpuTimer0.InterruptCount++;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}
// funciones
void divideval(int a)
{
char tx_buff1[] = {60,1,1,12,9,20,15,12,34,0,5,8,9,8,62,0x13};
tx_envia(tx_buff1);
do { tx_envia(tx_buff1); loop();}
while (recibido!=65);
divideval2(dato);}
void divideval2(int a)
{
//voltaje 2
char tx_buff2[] = {60,1,2,12,9,20,15,12,34,0,5,8,9,8,62,0x13}};
do { tx_envia(tx_buff2); loop();}
while (recibido!=66);
divideval3(dato);
}
void divideval3(int a){
//voltaje 3
char tx_buff3[] = {60,1,3,12,9,20,15,12,34,0,5,8,9,8,62,0x13}
do { tx_envia(tx_buff3); loop();}
while (recibido!=67);
divideval4(dato);
}
void divideval4(int a){
//corriente 1
char tx_buff4[] = {60,1,4,12,9,20,15,12,34,0,5,8,9,8,62,0x13};
do { tx_envia(tx_buff4); loop();}
while (recibido!=68);
divideval5(dato);
}
void divideval5(int a){
//corriente 2
char tx_buff5[] = {60,1,5,12,9,20,15,12,34,0,5,8,9,8,62,0x13};
do { tx_envia(tx_buff5); loop();}
while (recibido!=69);
divideval6(dato);
}
void divideval6(int a){
//corriente 3
char tx_buff6[] = {60,1,6,12,9,20,15,12,34,0,5,8,9,8,62,0x13};
do { tx_envia(tx_buff6); loop();}
while (recibido!=70);
divideval7(dato);
}
void divideval7(int a){
//corriente 4
char tx_buff7[] ={60,1,7,12,9,20,15,12,34,0,5,8,9,8,62,0x13};
do{ tx_envia(tx_buff7); loop();}
while (recibido!=71);
divideval8(dato);
}
void divideval8(int a){
// fase 2
char tx_buff8[] = {60,1,8,12,9,20,15,12,34,0,5,8,9,8,62,0x13};
do{ tx_envia(tx_buff8); loop(); }
while (recibido!=72);
divideval9(dato);
}
void divideval9(int a){
//fase3
char tx_buff9[] = {60,1,9,12,9,20,15,12,34,0,5,8,9,8,62,0x13};
do { tx_envia(tx_buff9); loop();}
while (recibido!=73);
divideval10(dato);
}
void divideval10(int a){
//frecuencia1
char tx_buff10[] = {60,1,10,12,9,20,15,12,34,0,5,8,9,8,62,0x13};
do { tx_envia(tx_buff10); loop();}
while (recibido!=74);
divideval11(dato);
}
void divideval11(int a){
//frecuencia2
char tx_buff11[] = {60,1,11,12,9,20,15,12,34,0,5,8,9,8,62,0x13};
do { tx_envia(tx_buff11); loop();}
while (recibido!=75);
divideval12(dato);
}
void divideval12(int a){
//frecuencia 3
char tx_buff12[] = {60,12,1,12,9,20,15,12,34,0,5,8,9,8,62,0x13};
do { tx_envia(tx_buff12); loop();}
while (recibido!=76);
divideval13(dato);
}
void divideval13(int a){
//angulo 1
char tx_buff13[] = {60,1,13,12,9,20,15,12,34,0,5,8,9,8,62,0x13};
do{ tx_envia(tx_buff13); loop();}
while (recibido!=77);
divideval14(dato);
}
void divideval14(int a){
//angulo2
char tx_buff14[] = {60,1,14,12,9,20,15,12,34,0,5,8,9,8,62,0x13};
do{ tx_envia(tx_buff14); loop();}
while (recibido!=78);
divideval15(dato);
}
void divideval15(int a){
//angulo 3
char tx_buff15[] = {60,1,15,12,9,20,15,12,34,0,5,8,9,8,62,0x13};
do { tx_envia(tx_buff15); loop();}
while (recibido!=79);
}
void loop(void)
{
for(p=0;p<2000000;p++)
{
ScibRegs.SCIFFRX.bit.RXFFINTCLR=1;
ScibRegs.SCIRXBUF.all=0;
}
}
void tx_envia(char s[]){
int k=0;
while (s[k] !=0x13)
{
while (ScibRegs.SCIFFTX.bit.TXFFST != 0) {}
ScibRegs.SCITXBUF=s[k];
k++;
}
}