This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Change the Baudrate by program

Other Parts Discussed in Thread: TMS320F28335

 

Hello.

I will use with Mi DSP TMS320f28335 a Bluetooth Kit that I need to communicate by UART with AT commands.

At the first point I start my DSP with a 9600 baud rate and I send some AT commands with success to the Bluetooth Kit,

But This speed is not so fast and I need to change to 38400.

To do it I send to the Bluetooth KIT the command that change the Bluetooth Baud rate and after to do it I can't communicate with the bluetooth because there is different baud rate!

At this part the program need without reset My DSP change the DSP baud rate.

This is the code that initialize the DSP baud rate at 9600, send the AT command to change the Bluetooth baud rate, and after try to change the DSP baud rate.

 

void bt_open_uart()

{

      {

          SciaRegs.SCIFFTX.all=0xE060;

          SciaRegs.SCIFFRX.all=0x2061;

          SciaRegs.SCIFFCT.all=0x0;

          SciaRegs.SCIFFTX.bit.TXFIFOXRESET=1;

          SciaRegs.SCIFFRX.bit.RXFIFORESET=1;

      }

      // Conectar a 9600 para iniciar o modem

      {

            // Note: Clocks were turned on to the SCIA peripheral

            // in the InitSysCtrl() function

            SciaRegs.SCICCR.all =0x0007;   // 1 stop bit,  No loopback

                                                        // No parity,8 char bits,

                                                        // async mode, idle-line protocol

            SciaRegs.SCICTL1.all =0x0003;  // enable TX, RX, internal SCICLK,

                                                        // Disable RX ERR, SLEEP, TXWAKE

            SciaRegs.SCICTL2.all =0x0003;

                                                        //SciaRegs.SCICTL2.bit.TXINTENA = 1;

                                                        //SciaRegs.SCICTL2.bit.RXBKINTENA = 1;

            // Baud rate

          SciaRegs.SCIHBAUD    =0x0001;  // 9600 baud @LSPCLK = 37.5MHz.

           SciaRegs.SCILBAUD    =0x00E7;

            SciaRegs.SCICTL1.all =0x0023;  // Relinquish SCI from Reset

      }

      // Mudar a configuracao para 38400

      {

            bt_write_str("AT\r\n"); // Restaura configuração de fábrica

            bt_write_str("AT&F2\r\n"); // Restaura configuração de fábrica

      }

      // Conectar a 38400

      {

            // Note: Clocks were turned on to the SCIA peripheral

            // in the InitSysCtrl() function

           

            SciaRegs.SCICCR.all =0x0007;   // 1 stop bit,  No loopback

                                                        // No parity,8 char bits,

                                                        // async mode, idle-line protocol

            SciaRegs.SCICTL1.all =0x0003;  // enable TX, RX, internal SCICLK,

                                                        // Disable RX ERR, SLEEP, TXWAKE

            SciaRegs.SCICTL2.all =0x0003;

                                                        //SciaRegs.SCICTL2.bit.TXINTENA = 1;

                                                        //SciaRegs.SCICTL2.bit.RXBKINTENA = 1;

            // Baud rate

          SciaRegs.SCIHBAUD    =0x0000;  // 38400 baud @LSPCLK = 37.5MHz.

          SciaRegs.SCILBAUD    =0x0079;

          SciaRegs.SCICTL1.all =0x0023;  // Relinquish SCI from Reset

      }

}

Is Possible to change the DSP baud rate without reset the DSP?

Do you know if is  some things wrong at my code?

Thanks For all.