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.

CCS/TMS320F28335: TMS320F28335

Part Number: TMS320F28335

Tool/software: Code Composer Studio

Hey, i am new to F28335 board as well as CCS. I was going through some examples and had some doubts.

In the SCIA loopback enable example in CCS:

1. Why is the SCICTL2 register first set as 0x0003 in Line 3 which sets TXINTENA and RXBKINTENA and then immediately, both are set as 0. What is the significance of doing that? Instead SCICTL2 could have just been initialized as 0x0000 in a single line. Why cant that be done?

2. Or nothing needs to be initialized, since after reset, the default value itself of the register is itself 0x0000. So why should SCICTL1 register be initialized? Can that be done?

3. Similarly SCICCR register could also be set as 0x0017h, instead of separately setting  0x0007 in line 1 and enabling LOOPBKENA in line 8. Why should that be done separately?

4. What will happen if SCICTL2 register is initialized as 0x0023 in line 2 itself. Does initializing all the other registers, require software reset?

 

Line 1 : SciaRegs.SCICCR.all =0x0007;
Line 2 :SciaRegs.SCICTL1.all =0x0003;
Line 3 :SciaRegs.SCICTL2.all =0x0003;
Line 4 :SciaRegs.SCICTL2.bit.TXINTENA =0;
Line 5 :SciaRegs.SCICTL2.bit.RXBKINTENA =0;
Line 6 :SciaRegs.SCIHBAUD =0x0000;
Line 7 :SciaRegs.SCILBAUD =0x000F;
Line 8 :SciaRegs.SCICCR.bit.LOOPBKENA =1; // Enable loop back
Line 9 :SciaRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset

  • Anu,

    You are correct about your confusion with the example code.  This code was developed a while ago and my guess is the original author tried to use some common initialization code across all three examples (echoback, loopback, and loopback with interrupts) - again just a guess.

    Starting with question 1 and 2 - you are correct, it does not make sense in the loopback example to set SCICTL2 = 0x0003 and then immediately set TXINTENA and RXBKINTENA bits to '0'.  This effectively sets SCICTL2 = 0x0000.  The same was done for echoback.  However, the TXINTENA and RXBKINTENA bits need to be set to '1' for the interrupt example.  This might explain why SCICTL2 was original set to 0x0003 (but it does not explain why in the interrupt example the TXINTENA and RXBKINTENA bits are set to '1' again).  I could see the purpose of including a setting for SCICTL2, even if it is the default value, just so the user is aware of its value, making it easy to understand.

    For question 3, again using the same logic, I could understand that setting SCICCR = 0x0007 makes some sense since this is the common configuration across all example types  (1 stop bit,  no loopback, no parity, 8 characters bits, async mode, and idle-line protocol).  But, I would have placed the code to enable LOOPBKENA immediately after with a comment stating that "loop back is used for this example".  I am agreeing with you, both could have been done together.

    As for question 4 (I think you mean SCICTL1),you should not combine line 9 with line 2.  Line 9 is used to release the SCI from being held in reset afterthe peripheral has been configured.  It is good programming practice to configure peripherals when not running and then run after being configured.

    I hope this helps. If this answers your question, please click the green "Verified Answer" button. Thanks.

    - Ken

  • Yes i meant SCICTL1 i question 4. Thanks for your reply.