DSPRelated.com
Forums

DSP56307evm RS232 problems

Started by Mauro H Riva December 2, 2008
Hello everybody!...
I'm new here, and I have some problems with a motorola DSP56307evm
board. I'm doing a proyect that implements real time digital filters
with the EFCOP co-procesor and the CS4218 codec. I've implemented that.
But now, I want to change the coefficient table using RS232. I'm using
tasking compiler and I use the RS232 library (serio.c - serio_in.c -
serio_out.c and serio.h) but I have several problems with this.

This is the code I use:
file: serio.c

[...]
static void addcbuff(char c){ // Ade a cbuff
-----------------------
echos(c);
switch(c){
case 0x0D: // Enter -> Habilita Flag para
procesar
flagcommand=0x01; // Comando en Main
break;
default:
rsbuff[rsbuffind++]=c; // Ade caracter recibido al
Buffer

}
}
void _procesa_comando(void)
{
int i=0;
flagcommand=0x00; // Desactivo
flag de comando pendiente.

for(i=0;i todos los
_serio_put(rsbuff[i]);
}
inicbuff(); // Borro buffer.
}

static void echos(char c){ // Echo selectivo
----------------------

switch(c){
case 0x0D: _serio_put('E'); // Si he pulsado la tecla
[Intro]
break;
default: _serio_put(c); // Echo de cualquier otro
caracter
break;
}
}
static void _long_interrupt(IRQ_SCI_RCV) serial_rcv(void)
{
addcbuff(SRXL); /* put received data (character) in buffer */
}
[...]

//endfile
flagcommand is var that in the main routine is used in this way (in the
serio.c file it is declared as
extern int flagcommand);

file: main.c
[...]

if(flagcommand==0x01){ /* Si hay comando pendiente */
_procesa_comando(); /* de procesar ... lo procesa */
}else{

}
[...]
//endfile

The problem is that never enters to _procesa_comando() function!. And
when I enable CS4218 interrupt, it never sends the complete data. Can
anyone help me? Has anyone a working example or more information
available?
Thanks a lot!...
Hi Mauro,

it seems that the flagcommand 0x01 is never set. Debug on this. 'char c' is the variable the function addcbuff() is called with. If this variable is 0x0D (indeed this is 'return') this flag is set. The code shows clearly what you want it to do here...

Please make sure with your debugger if '0x0D' is representing the character . Unfortunately the language C is not 'data type safe' data are sometimes interpreted in another way than intended. Use your debugger, set a breakpoint on the function adcbuff() and see what is happening if this is called by hitting the key.

Regards

Christian

> Hello everybody!...
> I'm new here, and I have some problems with a motorola DSP56307evm
> board. I'm doing a proyect that implements real time digital filters
> with the EFCOP co-procesor and the CS4218 codec. I've implemented that.
> But now, I want to change the coefficient table using RS232. I'm using
> tasking compiler and I use the RS232 library (serio.c - serio_in.c -
> serio_out.c and serio.h) but I have several problems with this.
>
> This is the code I use:
> file: serio.c
>
> [...]
> static void addcbuff(char c){ // Ade a cbuff
> -----------------------
> echos(c);
> switch(c){
> case 0x0D: // Enter -> Habilita Flag para
> procesar
> flagcommand=0x01; // Comando en Main
> break;
> default:
> rsbuff[rsbuffind++]=c; // Ade caracter recibido al
> Buffer
>
> }
> }
> void _procesa_comando(void)
> {
> int i=0;
> flagcommand=0x00; // Desactivo
> flag de comando pendiente.
>
> for(i=0;i > todos los
> _serio_put(rsbuff[i]);
> }
> inicbuff(); // Borro buffer.
> }
>
> static void echos(char c){ // Echo selectivo
> ----------------------
>
> switch(c){
> case 0x0D: _serio_put('E'); // Si he pulsado la tecla
> [Intro]
> break;
> default: _serio_put(c); // Echo de cualquier otro
> caracter
> break;
> }
> }
> static void _long_interrupt(IRQ_SCI_RCV) serial_rcv(void)
> {
> addcbuff(SRXL); /* put received data (character) in buffer */
> }
> [...]
>
> //endfile
> flagcommand is var that in the main routine is used in this way (in the
> serio.c file it is declared as
> extern int flagcommand);
>
> file: main.c
> [...]
>
> if(flagcommand==0x01){ /* Si hay comando pendiente */
> _procesa_comando(); /* de procesar ... lo procesa */
> }else{
>
> }
> [...]
> //endfile
>
> The problem is that never enters to _procesa_comando() function!. And
> when I enable CS4218 interrupt, it never sends the complete data. Can
> anyone help me? Has anyone a working example or more information
> available?
> Thanks a lot!...
>