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.

TMS320F28027F SCIA not sending all chars

Hi Folks,


It's taken me a while to zero in on the problem but it looks like my SCI TX routines aren't sending all of the chars.

Here are my two TX char and TX string routines in my SCI.C file:

void SCI_write_char(SCI_Handle sciHandle, char a)
 { 
  SCI_Obj *sci = (SCI_Obj *)sciHandle;
  while(SCI_getTxFifoStatus(sci) != SCI_FifoStatus_Empty){ }
     SCI_write(sci, a);
 } 

void SCI_write_str(SCI_Handle sciHandle, char* str)
 { 
  while(*str != '\0')
    { SCI_write_char(sciHandle, *str++); 
    }
 }




In my main() file I'm testing the TX with:

str2 =  "0.123456"
SCI_write_str(halHandle->sciAHandle, str2);<----breakpoint #1 here
str = "9876543"; SCI_write_str(halHandle->sciAHandle, str);<----breakpoint #2 here

I've placed breakpoints after each write and can see an odd behavior. In the RealTerm output window I get: 0.12345 after it hits breakpoint#2 and then when I let it run to breakpoint#1 the 6 shows up to complete str2 and all but the the last digit of str shows up (987654).  When I let it go again to breakpoint#2 the last digit of str shows up (the 3) and again 7 of the 8 digits of str2.

Any ideas on how can I get all of the chars that I'm sending to the TX FIFO?

Thanks,

Richard C.

  • Hello Richard,


    can you please show us your SCI configs? Especially the FIFO configs.

    Regards, Werner

  • I should have included my SCI setup in my original post - sorry about that.  Here it is:

    Thanks,

    void HAL_setupSciA(HAL_Handle handle)
    {
        HAL_Obj  *obj = (HAL_Obj *)handle;
    
        // SCI stop bit, parity, loopback, char bits, idle/address mode
        SCI_setNumStopBits(obj->sciAHandle, SCI_NumStopBits_One);
        SCI_disableParity(obj->sciAHandle);
        SCI_disableLoopBack(obj->sciAHandle);
        SCI_setMode(obj->sciAHandle, SCI_Mode_IdleLine);
        SCI_setCharLength(obj->sciAHandle, SCI_CharLength_8_Bits);
    
        // TX enable, RX enable, RX ERR INT enable, SLEEP, TXWAKE (SCICTL1 = 0x03)
        SCI_disableRxErrorInt(obj->sciAHandle);
        SCI_disable(obj->sciAHandle);
        SCI_disableTxWake(obj->sciAHandle);
        SCI_disableSleep(obj->sciAHandle);
        SCI_enableTx(obj->sciAHandle);
        SCI_enableRx(obj->sciAHandle);
        SCI_enableTxFifo(obj->sciAHandle);
        SCI_enableTxFifoEnh(obj->sciAHandle);
        SCI_enableRxFifo(obj->sciAHandle);
        SCI_enableRxFifoInt(obj->sciAHandle);
        SCI_setRxFifoIntLevel(obj->sciAHandle, SCI_FifoLevel_1_Word);	// sets FIFO depth before trigering INT
    
        // TXINT enable, RXINT enable, TXEMPTY, TXRDY (SCICTL2 = 0x03)
        SCI_enableRxInt(obj->sciAHandle);
        SCI_enableRxFifo(obj->sciAHandle);
        SCI_disableTxInt(obj->sciAHandle);
        SCI_disableSleep(obj->sciAHandle);
    
        // SCIH-SCIL BAUD - SCI_BAUD = (LSPCLK/(SCI_BRR*8)) - 1
        SCI_setBaudRate(obj->sciAHandle, SCI_BaudRate_57_6_kBaud);
        CLK_enableSciaClock(obj->clkHandle);
    
        // Reset SCI
        SCI_enable(obj->sciAHandle);
    
        // enable SCI interrupt
        PIE_enableInt(obj->pieHandle, PIE_GroupNumber_9, PIE_InterruptSource_SCIARX);
    
        // enable CPU interrupt
        CPU_enableInt(obj->cpuHandle, CPU_IntNumber_9);
    
        return;
    }	// end of HAL_setupSCI() function
    

    Richard C.

  • Hmm, it is really strange. Have you already tried to send and receive in loopback mode? Can you set a breakpoint in the TX interrupt and observe if the last value (6/3) is written into the FIFO? First we have to make sure if it is a transmit or a receive problem.
  • Werner,

    Currently I'm not using the TX INT. I only have the RX INT enabled. I'll try and try to get the loopback working so I can see where the missing char might be hiding.

    Thanks,

    Richard C.
  • Richard,

    I wanted to check if you have resolved the problem you were having.

    Thank you
    Lori
  • Hi Lori,

    I think so but another fire has erupted so I've had to but this away for now. Most of my tests showed that I was getting the proper number of chars sent and received but when I can find the time I'll have to do more rigorous testing.

    Sorry I can't give you a form answer yet.

    Richard