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.

Receive a data stream in SCI-B

Other Parts Discussed in Thread: CONTROLSUITE

I am trying to read a data stream of 80 bits that's going to come into SCIbRx. The first 16 bits is Sync Pattern, next 16 is ID, next 16 is command (bits of interest),
next 16 is argument (filled with zeros), and the last 16 bits are checksum. I have a preliminary code written below. I hope it can be followed. I am having some
difficulty.
First, how do I store all 80 bits into a variable when the SCIBRx_BUF is only 8 bits long. I am trying to do something like that to look at Sync Pattern below.
Secondly, is it possible to store 16 bits at a time into different variables.
Thirdly, what command controls when to write in buffer when it is filled with first 8 bits, because I was thinking to store those values in a variable, clear the buffer, write to buffer and start all over again?
Lastly, is there a good crc program for F28335 control card?

Thanks.
Waqqas

{
    Uint16 i;
    Uint16 Sync = 0x7E;          // A constant value which always marks the start of a packet
    Uint16 StreamLength = 80;           // Number of bits in payload;
    Uint16 crc;                              //Checksum
    Uint16 SyncPattern;
    Uint16 myID;
    Uint16 Data;
    rdataB = ScibRegs.SCIRXBUF.all;  // Read data
    SyncPattern = (rdataB & 0xFF) >> 16;
    while (rdataB > 0) {     // SCIB Available Data
    // read the incoming byte: // Read data
        if (SyncPattern  == Sync)
        {
            myID = (rdataB & (16 << StreamLength - 16)) != 0;
            Data = (rdataB & 0x0F);
    ScibRegs.SCIFFRX.bit.RXFFOVRCLR=1;  // Clear Overflow flag
    ScibRegs.SCIFFRX.bit.RXFFINTCLR=1;  // Clear Interrupt flag
    PieCtrlRegs.PIEACK.all|=0x100;      // Issue PIE ack
}
  • Hi,

    I recommend looking at the F28335 Technical Reference Manual and looking at the examples provided in controlSUITE.

    Since your data is in 16-bit sections, I would create a variable for each of the fields (syncPattern, ID, command, argument, checksum). You can only read 8-bits at a time from SCIbRegs.SCIRXBUF.all.

    Try something like below assuming you are sending the LSB first and then then the MSB:

    // Wait for inc character
    while(SciaRegs.SCIRXST.bit.RXRDY !=1) { } // wait for RXRDY =1 for ready state

    // Get LSB of syncPattern
    syncPattern = (SciaRegs.SCIRXBUF.all & 0xFF);

    // Wait for inc character
    while(SciaRegs.SCIRXST.bit.RXRDY !=1) { } // wait for RXRDY =1 for ready state

    // Get MSB of syncPattern
    syncPattern |= (SciaRegs.SCIRXBUF.all & 0xFF) << 8;

    I am confused by your third question... Are you trying to send/echo the data back? When you read from SCIRXBUF the data will be cleared from the buffer.

    There are also TX and RX FIFOs which can be used if you like.

    You do not need to ACK the PIE if you are not using interrupts.

    We not have a library available for theF2833x which contains a CRC calculation. However, we do have a C source file which you can use. Note: the F2833x does not have a VCU accelerator. See www.ti.com/.../spry288.pdf

    controlSUITE has the source C files and functions you would need for a CRC.
    controlSUITE\libs\dsp\VCU\<version>\source\C28x_VCU_LIB\crc

    Hope this helps.

    sal
  • Hi Sal,

    Thanks for your response. I want to clarify a few things. My code is based on the SCIA_Loopback_interrupt example. I am running the SCIB-Receive as a form of interrupt. I have a SCIB-Transmit Interrupt running too within the same program.

    I tried your code, and I am sending in 4095 as an example for SyncPattern from SCITXBUF. In the SCIRXBUF, I am intending to read 4095, but the code doesn't go through. It stops at the 2nd while loop waiting for 1 which never comes.

    I intend to send 80 bits into SCITXBUF in SCI-Transmit Interrupt and intend to read it all in SCI-Receive using your example for different variables.

    Am I missing something in the code that's preventing me from reading all 4095 for example.

    The main program stops at a while loop where it continuously looks for an interrupt.

    Thanks.

    Waqqas

    __interrupt void scibTxFifoIsr(void)
    {
    	Uint16 i;
    	Uint16 j;
    	for(i=0; i< 8; i++)
    	{
    		ScibRegs.SCITXBUF=sdataB[i];          // Send data
    	}
    
    	for(i=0; i< 8; i++){
    		for (j=0; j<10; j++){                 //Increment send data for next cycle
    		sdataB[i] = Voltage2[j];              //Voltage 2 is 4095 value
    		}
    	}
    
    	ScibRegs.SCIFFTX.bit.TXFFINTCLR=1;  // Clear Interrupt flag
    	PieCtrlRegs.PIEACK.all|=0x100;      // Issue PIE ACK
    }
    
    __interrupt void scibRxFifoIsr(void)
    {
    	// Wait for inc character
    	while(ScibRegs.SCIRXST.bit.RXRDY !=1) { } // wait for RXRDY =1 for ready state
    	
    	// Get LSB of syncPattern
    	syncPattern = (ScibRegs.SCIRXBUF.all & 0xFF);
    
    	// Wait for inc character
    	while(ScibRegs.SCIRXST.bit.RXRDY !=1) { } // wait for RXRDY =1 for ready state
    
    	// Get MSB of syncPattern
    	syncPattern |= (ScibRegs.SCIRXBUF.all & 0xFF) << 8;
    
    
    //	rdataB=ScibRegs.SCIRXBUF.all;	 // Read data
    
    	ScibRegs.SCIFFRX.bit.RXFFOVRCLR=1;  // Clear Overflow flag
    	ScibRegs.SCIFFRX.bit.RXFFINTCLR=1; 	// Clear Interrupt flag
    	PieCtrlRegs.PIEACK.all|=0x100;  	// Issue PIE ack
    }
    
    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 SCICLK,
    									// Disable RX ERR, SLEEP, TXWAKE
    	ScibRegs.SCICTL2.bit.TXINTENA =1;
    	ScibRegs.SCICTL2.bit.RXBKINTENA =1;
    	ScibRegs.SCIHBAUD    =0x0000;
    	ScibRegs.SCILBAUD    =SCI_PRD;
    	ScibRegs.SCICCR.bit.LOOPBKENA =1; // Enable loop back
    	ScibRegs.SCIFFTX.all=0xC028;
    	ScibRegs.SCIFFRX.all=0x0028;
    	ScibRegs.SCIFFCT.all=0x00;
    
    	ScibRegs.SCICTL1.all =0x0023;     // Relinquish SCI from Reset
    //	ScibRegs.SCIFFTX.bit.TXFFST = 0x000A;
    	ScibRegs.SCIFFTX.bit.TXFIFOXRESET=1;
    	ScibRegs.SCIFFRX.bit.RXFIFORESET=1;
    //	ScibRegs.SCIFFRX.bit.RXFFST = 0x000A;
    }

  • If you are using an interrupt, RXRDY should not be used. I was not aware you were using interrupts.

    Because you are using interrupts, you should use RXFFIL, the FIFO interrupt level to generate an RX Interrupt. Once the FIFO reaches the level you set in RXFFIL (10), it will generate an interrupt and you will be able to read 10 bytes (8-bits) from the RXFIFO.

    sal
  • Thanks Sal,
    I did try what you suggested, but it is still not working. More help and guidance will be appreciated.

    Thanks.

    Waqqas
  • Please see   

    You should get familiar with the SCI module and its register.

    I can help you better if you give me details of what is not working or what you have changed.  Or you can post some code and I can examine it.

    Hope this helps.

    sal

  • Hi Sal,

    So the problem is that I am sending 2 bytes (for now - will increase it to 10 bytes, as the whole command stream coming in is 10 bytes that I have to put in different variables for comparison) to SCIB. I have put in TXFFST as 2 words. After passing through the FIFO, I am trying to read the 2 bytes from SCIRXBUF. The problem is that I am only receiving the last byte and not the whole 2 bytes. I tried your suggestion and used RXFFIL as 2 bytes along with using TXFFIL as 2 bytes so that I send and receive 2 bytes.

    sdataB = Sending data to SCITXBUF = Voltage 1 (value of 4095)

    rdataB = Receiving data from SCIRXBUF = Should be value of 4095, but I am getting 255.

    My code is similar to SCI_Loopback_enable example. The code runs on many different interrupts for SCI(A/B)_TX_FIFO and SCI(A/B)_RX_FIFO.

    What I am focusing on is SCIB, because SCIA is working on something else and is good for now. I need SCIB to transmit and receive at least 2 bytes for now.

    One thing, I noticed is that when I run the code, TXFFST = 16 words, however, RXFFST = 1 word. Is that something that's affecting me in receiving the whole values back. If yes, how do I set RXFFST = 16. I tried putting it in code for it to equal 16, but to no effect.

    And lastly, I had read through the SCI module pdf and that's as far as I got with what I could understand.

    I hope this will help you in understanding my problem. Thanks.

    Waqqas

    The complete code is as follows and is easy to follow

    #define CPU_FREQ 	 150E6
    #define LSPCLK_FREQ  CPU_FREQ/4
    #define SCI_FREQ 	 100E3
    #define SCI_PRD 	 (LSPCLK_FREQ/(SCI_FREQ*8))-1
    
    // Prototype statements for functions found within this file.
    __interrupt void sciaTxFifoIsr(void);
    __interrupt void sciaRxFifoIsr(void);
    __interrupt void scibTxFifoIsr(void);
    __interrupt void scibRxFifoIsr(void);
    __interrupt void adc_isr(void); // Prototype statements for functions found within this file. User Defined
    void scia_fifo_init(void);
    void scib_fifo_init(void);
    void error(void);
    
    // User variables
    Uint16 LoopCount;
    Uint16 ConversionCount;
    Uint16 Voltage1;
    Uint16 Voltage2;
    
    //--- Global Variables
    Uint16 AdcBuf[ADC_BUF_LEN];					// ADC buffer allocation
    Uint16 DEBUG_TOGGLE = 1;					// Used in realtime mode investigation - Lab 6
    Uint32 PwmDuty;								// measured PWM duty cycle
    Uint32 PwmPeriod;							// measured PWM period
    Uint16 sdataA[8];    // Send data for SCI-A
    Uint16 sdataB[8];    // Send data for SCI-B
    Uint16 rdataA[8];    // Received data for SCI-A
    Uint16 rdataB[8];    // Received data for SCI-A
    Uint16 rdata_pointA; // Used for checking the received data
    Uint16 rdata_pointB;
    Uint16 syncPattern;
    Uint16 Sync = 0x7E;          // A constant value which always marks the start of a packet
    Uint16 StreamLength = 80;			// Number of bits in payload
    Uint16 DataReceived;
    Uint16 crc;
    Uint16 myID;
    Uint16 Data;
    /**********************************************************************
    * Function: main()
    *
    * Description: Main function for C28x workshop labs
    **********************************************************************/
    void main(void)
    {
    	Uint16 i;
    	LoopCount = 0;
    	ConversionCount = 0;
    //--- CPU Initialization
    	
            InitSysCtrl();						// Initialize the CPU (FILE: SysCtrl.c)
    
    	EALLOW;
    	#if (CPU_FRQ_150MHZ)     // Default - 150 MHz SYSCLKOUT
    		#define ADC_MODCLK 0x3 // HSPCLK = SYSCLKOUT/2*ADC_MODCLK2 = 150/(2*3)   = 25.0 MHz
    	#endif
    	#if (CPU_FRQ_100MHZ)
    		#define ADC_MODCLK 0x5 // HSPCLK = SYSCLKOUT/2*ADC_MODCLK2 = 100/(2*5)   = 10.0 MHz
    	#endif
    	EDIS;
    
    // Define ADCCLK clock frequency ( less than or equal to 25 MHz )
    // Assuming InitSysCtrl() has set SYSCLKOUT to 150 MHz
    	EALLOW;
    	SysCtrlRegs.HISPCP.all = ADC_MODCLK;
    	EDIS;
    
    	InitGpio();							// Initialize the shared GPIO pins (FILE: Gpio.c)
    	InitPieCtrl();						// Initialize and enable the PIE (FILE: PieCtrl.c)
    	InitSciGpio();						// Initialize the shared SCI GPIO pins (FILE: Sci.c)
    
    // Step 3. Clear all interrupts and initialize PIE vector table:
    // Disable CPU interrupts
    	DINT;
    
    // Disable CPU interrupts and clear all CPU interrupt flags:
    	IER = 0x0000;
    	IFR = 0x0000;
    
    	InitPieVectTable();
    
    // Interrupts that are used in this example are re-mapped to
    // ISR functions found within this file.
       EALLOW;	// This is needed to write to EALLOW protected registers
       PieVectTable.SCITXINTA = &sciaTxFifoIsr;
       PieVectTable.SCIRXINTA = &sciaRxFifoIsr;
       PieVectTable.SCITXINTB = &scibTxFifoIsr;
       PieVectTable.SCIRXINTB = &scibRxFifoIsr;
       PieVectTable.ADCINT = &adc_isr;
       EDIS;   // This is needed to disable write to EALLOW protected registers
    
    //--- Peripheral Initialization
       InitAdc();							// Initialize the ADC (FILE: Adc.c)
    
    // Step 4. Initialize all the Device Peripherals:
    // This function is found in DSP2833x_InitPeripherals.c
       scia_fifo_init();  // Init SCI-A
       scib_fifo_init();  // Init SCI-B
    
    // Enable interrupts required for this example
       PieCtrlRegs.PIECTRL.bit.ENPIE = 1;   // Enable the PIE block
       PieCtrlRegs.PIEIER9.bit.INTx1=1;     // PIE Group 9, int1
       PieCtrlRegs.PIEIER9.bit.INTx2=1;     // PIE Group 9, INT2
       PieCtrlRegs.PIEIER9.bit.INTx3=1;     // PIE Group 9, INT3
       PieCtrlRegs.PIEIER9.bit.INTx4=1;     // PIE Group 9, INT4
       IER = 0x100;	// Enable CPU INT
       IER |= 0x0001;						// Enable INT1 in IER to enable PIE group
    // Enable ADCINT in PIE
       PieCtrlRegs.PIEIER1.bit.INTx6 = 1;
       IER |= M_INT1; // Enable CPU Interrupt 1
       EINT;          // Enable Global interrupt INTM
       ERTM;          // Enable Global realtime interrupt DBGM
    
       //--- Enable global interrupts
       asm(" CLRC INTM, DBGM");			// Enable global interrupts and realtime debug
    
    // Configure ADC
       AdcRegs.ADCMAXCONV.all = 0x0001;       // Setup 2 conv's on SEQ1
       AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x3; // Setup ADCINA3 as 1st SEQ1 conv.
       AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0x2; // Setup ADCINA2 as 2nd SEQ1 conv.
       AdcRegs.ADCTRL2.bit.EPWM_SOCA_SEQ1 = 1;// Enable SOCA from ePWM to start SEQ1
       AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 1;  // Enable SEQ1 interrupt (every EOS)
    // Assumes ePWM1 clock is already enabled in InitSysCtrl();
       EPwm1Regs.TBCTL.bit.CLKDIV=0x3;
       EPwm1Regs.TBCTL.bit.HSPCLKDIV=0x7;
       EPwm1Regs.ETSEL.bit.SOCAEN = 1;        // Enable SOC on A group
       EPwm1Regs.ETSEL.bit.SOCASEL = 4;       // Select SOC from from CPMA on upcount
       EPwm1Regs.ETPS.bit.SOCAPRD = 1;        // Generate pulse on 1st event
       EPwm1Regs.CMPA.half.CMPA = 0x0080;	  // Set compare A value
       EPwm1Regs.TBPRD = 0xFFFF;              // Set period for ePWM1
       EPwm1Regs.TBCTL.bit.CTRMODE = 10;		  // count up down and start
    
    // Step 5. User specific code, enable interrupts:
    // Init send data.  After each transmission this data
    // will be updated for the next transmission
      
          for(i = 0; i<8; i++){
    	   sdataA[i] = Voltage1;
       }
          for(i = 0; i<8; i++){
    	   sdataB[i] = Voltage2;
    
       }
    //   rdata_pointA = sdataA[0];
    //   rdata_pointB = sdataB[0];
    
    // Step 6. IDLE loop. Just sit and loop forever (optional):
    
    //--- Main Loop
    	while(1)							// endless loop - wait for an interrupt
    	{
    		asm(" NOP");
    	}
    
    }
    
    void error(void)
    {
    	__asm("     ESTOP0"); // Test failed!! Stop!
    	for (;;);
    }
    
    __interrupt void sciaTxFifoIsr(void)
    {
    	Uint16 i;
    	for(i=0; i< 8; i++)
    	{
    	   SciaRegs.SCITXBUF=sdataA[i];     // Send data
    	}
    
    	for(i=0; i< 8; i++){
    		sdataA[i] = Voltage1;		//Increment send data for next cycle
    	}
    
    	SciaRegs.SCIFFTX.bit.TXFFINTCLR=1;	// Clear SCI Interrupt flag
    	PieCtrlRegs.PIEACK.all|=0x100;      // Issue PIE ACK
    }
    
     __interrupt void sciaRxFifoIsr(void)
    {
    	 Uint16 i;
    	 for(i=0; i<8; i++) {
    		 rdataA[i]=SciaRegs.SCIRXBUF.all;	 // Read data
    	 }
    
    	 SciaRegs.SCIFFRX.bit.RXFFOVRCLR=1;   // Clear Overflow flag
    	 SciaRegs.SCIFFRX.bit.RXFFINTCLR=1;   // Clear Interrupt flag
    	 PieCtrlRegs.PIEACK.all|=0x100;       // Issue PIE ack
    }
    
    void scia_fifo_init()
    	{
    	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.bit.TXINTENA =1;
    	SciaRegs.SCICTL2.bit.RXBKINTENA =1;
    	SciaRegs.SCIHBAUD = 0x0000;
    	SciaRegs.SCILBAUD = SCI_PRD;
    	SciaRegs.SCICCR.bit.LOOPBKENA =1; // Enable loop back
    	SciaRegs.SCIFFTX.all=0xC028;
    	SciaRegs.SCIFFRX.all=0x0028;
    	SciaRegs.SCIFFCT.all=0x00;
    
    	SciaRegs.SCICTL1.all =0x0023;     // Relinquish SCI from Reset
    	SciaRegs.SCIFFTX.bit.TXFIFOXRESET=1;
    	SciaRegs.SCIFFRX.bit.RXFIFORESET=1;
    	}
    
    __interrupt void scibTxFifoIsr(void)
    {
    	Uint16 i;
    	for(i=0; i< 8; i++)
    	{
    		ScibRegs.SCITXBUF=sdataB[i];     // Send data
    	}
    
    	for(i=0; i< 8; i++){
    		sdataB[i] = Voltage2;				//Increment send data for next cycle
    	}
    	ScibRegs.SCIFFTX.bit.TXFFINTCLR=1;  // Clear Interrupt flag
    	PieCtrlRegs.PIEACK.all|=0x100;      // Issue PIE ACK
    }
    __interrupt void scibRxFifoIsr(void)
    {
    	Uint16 i;
    	for(i=0;i<8;i++)
    	{
    		rdataB[i]=ScibRegs.SCIRXBUF.all;
    	
            //	syncPattern = (ScibRegs.SCIRXBUF.all & 0xFF);
    	//	syncPattern |= (ScibRegs.SCIRXBUF.all & 0xFF) << 8;// Read data
    	}
    //	rdataB[i] = ScibRegs.SCIRXBUF.all;	 // Read data
    //		SyncPattern = (rdataB & 0xFF) >> 8;
    //	while (rdataB > 0) {  	// SCIB Available Data
    	// read the incoming byte: // Read data
    //		if (SyncPattern  == Sync)
    //		{
    //			myID = (rdataB & (4 << StreamLength - 4)) != 0;
    //			Data = (rdataB & 0x0F);
    
    	//	}
    //		printf ("ID" =  ID);
    
    //	}
    
    	ScibRegs.SCIFFRX.bit.RXFFOVRCLR=1;  // Clear Overflow flag
    	ScibRegs.SCIFFRX.bit.RXFFINTCLR=1; 	// Clear Interrupt flag
    	PieCtrlRegs.PIEACK.all|=0x100;  	// Issue PIE ack
    }
    
    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 =0x0047;//3;   // enable TX, RX, internal SCICLK,
    									// Disable RX ERR, SLEEP, TXWAKE
    	ScibRegs.SCICTL2.bit.TXINTENA =1;
    	ScibRegs.SCICTL2.bit.RXBKINTENA =1;
    	ScibRegs.SCIHBAUD    =0x0000;
    	ScibRegs.SCILBAUD    =SCI_PRD;
    	ScibRegs.SCICCR.bit.LOOPBKENA =1; // Enable loop back (Doesnt work on 0)
    	ScibRegs.SCIFFTX.all=0xC028;
    	ScibRegs.SCIFFRX.all=0x0028;
    	ScibRegs.SCIFFCT.all=0x00;
    
    	ScibRegs.SCICTL1.all =0x0023;     // Relinquish SCI from Reset
    	ScibRegs.SCIFFTX.bit.TXFIFOXRESET=1;
    	ScibRegs.SCIFFRX.bit.RXFIFORESET=1;
    	ScibRegs.SCIFFTX.bit.TXFFST = 10000;
    	ScibRegs.SCIFFTX.bit.TXFFIL = 0x000F;
    	ScibRegs.SCIFFRX.bit.RXFIFORESET=1;
    
    	ScibRegs.SCIFFRX.bit.RXFFINTCLR = 1;
    	ScibRegs.SCIFFRX.bit.RXFFINT = 1;
    	ScibRegs.SCIFFRX.bit.RXFFOVRCLR = 1;
    	ScibRegs.SCIFFRX.bit.RXFFST = 10000;
    	ScibRegs.SCIFFRX.bit.RXFFIL = 0x000F;
    }
    
    __interrupt void  adc_isr(void)
    {
      Voltage1 = AdcRegs.ADCRESULT0 >>4;
      Voltage2 = AdcRegs.ADCRESULT1 >>4;
      // If 40 conversions have been logged, start over
      if(ConversionCount == 9)
      {
         ConversionCount = 0;
      }
      else
      {
          ConversionCount++;
      }
      // Reinitialize for next ADC sequence
      AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1;         // Reset SEQ1
      AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;       // Clear INT SEQ1 bit
      PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;   // Acknowledge interrupt to PIE
    
      return;
    }
    //===========================================================================
    // No more.
    //===========================================================================
    

  • you are setting the SCIA and SCIB TXFFIL and RXFFIL to 8. That means after the corresponding FFST (fifo status) equals 8, then it will generate an interrupt, tx and rx respectively.

    You cannot write to RXFFST or TXFFST because those are read only bit fields.

    When you write ScibRegs.SCIFFTX.bit.TXFFIL = 0x000F; you are setting the TX FIFO Interrupt Level to 15. That means it will generate an interrupt if the FIFO size gets to 15 or more.

    When you write ScibRegs.SCIFFRX.bit.RXFFIL = 0x000F; you are setting the RX FIFO Interrupt Level to 15. That means it will igenerate an interrupt if the FIFO size gets to 15 or more. That means that there are 15 characters in the FIFO available to be read from SCIRXBUF register.

    If you want to read 8 characters from the FIFO in your RX interrupt, set RXFFIL = 8;

    You are attempting to send scia[] and scib[]. these are arrays of uint16_t. You cannnot do this. You cannot send 16-bits of data by writing 16-bits to the TXBUF. You cannot read 16-bits of data by reading RXBUF. SCI/UART/Serial Communication is only able to send 8-bit data.

    SCI only transfers and receives 8-bit characters. It is impossible to read 4095 from an 8-bit character. There is not enough data. As I described in my initial response, you need to read from SCIRXBUF twice in order to get 16-bits of data. You will need to shift one of the characters to the lefty 8bits and or it with the other 8-bit character in order to get a 16-bit value.


    This is why you are only reading 255. You are only sending 255, 0xFF. You are not able to send 0xFFFF in one shot. So you need to send 0xFFFF and then send 0xFFFF. And then you need to read 0xFFFF and then read 0xFFFF.
  • Sal,
    Thank You for the last reply. Understood many things, and many misconceptions were cleared. I am able to transmit 16 bit word and able to receive 16 bit word.
    I am now going to go ahead and expand the sending and receiving of 80 bit words based on the same analogy and introduce checksum in end.

    Thanks.
    Waqqas
  • Sal,
    I posted a new question based on the same problem, but now looking at the whole data stream of 64 bits now.
    I will appreciate it, if you can have a look, if possible.

    e2e.ti.com/.../444179

    Thanks.

    Waqqas