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.

SCI code examples for the tms320f28335

Other Parts Discussed in Thread: TMS320F28335, TMDSDOCK28335

What would the best code examples to look at for using the SCI with the tms320f28335?

I am currently using the TMDSDOCK28335 Experimenter’s kit.

SPRC530 has an example project Example_2833xSci_Echoback. This example prints a banner, and then echos received characters. This works ok if I send single characters to the device with significant spacing between characters, however if I send some characters close together, the program will stop working, and will not work again until I reset the CPU and reload the program.

If I halt the processor after the program has stopped working, it halts at line 159 in the file "Example_2833xSci_Echoback.c". The line is as follows: "while(SciaRegs.SCIFFRX.bit.RXFFST !=1) { } // wait for XRDY =1 for empty state".

  • Hi David,

    #1 The example you are looking at is not interrupt driven.

    #2 It transmits a message after each character is received, during which time the hardware FIFO can receive several characters (more than 1). But the test is waiting for only 1 char. To fix this problem, change "while(SciaRegs.SCIFFRX.bit.RXFFST !=1)" to "while(SciaRegs.SCIFFRX.bit.RXFFST == 0)"

    A better solution is to have interrupt driven input and output queues used in conjunction with the hardware FIFO. Our block-diagram model-based software VisSim/ECD provides exactly this. It let's you simulate your algorithm off-line or generated code and execute it on the F28335 target. If you install our free trial, you will find an example diagram under VisSim/DSP > F280x > Examples > F283x > SerialEchoPAF283x that will show you how to use the SCI under VisSim. (There are also samples for SerialEchoPBF283x for SCIB and SerialEchoPCF283x for SCIC)

    There are blocks to support the SCI, SPI, ADC, I2C, PWM, QEP, CAP, CAN, GPIO, XINT, Then you use the code generation capability to automatically generate C-code, compile and download to the target. Our JTAG link allows you to capture waveforms on the target and plot them in a digital scope on the PC. While you can generate complete application with VisSim alone, you can also use the VisSim CCS plugin to incorporate generated code into your existing applications. VisSim supports All F280x, F282xx, F283xx targets.

    You can download a 2 month free trial here.

    Regards,

    Pete

  • vsi-pete said:

    Hi David,

    #1 The example you are looking at is not interrupt driven.

    #2 It transmits a message after each character is received, during which time the hardware FIFO can receive several characters (more than 1). But the test is waiting for only 1 char. To fix this problem, change "while(SciaRegs.SCIFFRX.bit.RXFFST !=1)" to "while(SciaRegs.SCIFFRX.bit.RXFFST == 0)"

    Thanks for your reply.

    Yes I realise that it is not interrupt driven, but for the initial test that I am running this does not matter. If I end up using this processor in my project, then I will have to make the SCI interrupt driven, rather than polled.

    I had not really tried to diagnose this fault, I was hoping that some good examples of using the SCI existed that I could use. This code is provided by ti as a simple example of using the SCI, now that I look at the code in more detail, it is rather an odd choice to loop indefinately while the FIFO does not contain exactly 1 character.