Tips for TI Board and CCS

Setting the Correct CCS IDE and SDK Version

  1. Start by first going to the https://dev.ti.com/ page to use the cloud version of the CCS IDE and SDK; the CCS IDE is called CCS Cloud (note: you might need to download and install the TI Cloud Agent, etc., and link up your board to your computer before you can launch the CCS Cloud IDE or the Resource Explorer for the various SDK versions and the example drivers for the LED, etc.):
  2. The CCS Cloud IDE looks something like the following. However, they’re updating versions so it might look different in some ways, as well. In addition, you might need to register for a TI account and verify your email and password with them before it launches the CCS Cloud IDE as below:

    or it might look like this blank version at first:
  3. Next, start the Resource Explorer on the previous tab to make sure we’re hooked into the correct SDK version:
  4. Then, check to see which version of the SDK is installed; if it is not ver 4.30.00.06 (likely it’s a newer version), then you need to install the older version (4.30.00.06). Start by clicking Manage Versions:
  5. Scroll down and pick the version you want to install (4.30.00.06):
  6. Then, check the Resource Explorer to ensure the correct SDK versions are installed:

    or
  7. You can always manage versions later from the Resource Explorer again
  8. You can then Import the pwmled2 project as in the lab directions; namely, by expanding to pwmled2, No RTOS, and CCS Compiler and then clicking the three dots icon to “Import to CCS IDE”:
  9. You can also click the import button to the right of the path, of course:
  10. If you (optionally) download it, it should look something like this:
  11. Once you import it, it should launch the CCS Cloud IDE:
  12. You should skip the upgrade, if possible, and then the project itself will be there ready for you to build and modify:

    or it might look more like this:
  13. Open the pwmled2.c file. Now, when you click the “Run” button in the top right of the top picture, it will compile the program and load it to the board and execute (the LED light will start blinking). Here is a picture of the program compiling after the Run button is  pressed in the Menu next to the Build button:
  14. The successful run will be indicated as:
  15. If you instead press Debug, you should see the normal debugging windows, as follows:


uartecho vs uartecho2

If you're using an SDK version greater than 4.40, you'll likely see uartecho2 rather than uartecho. In order to get uartecho, please do ensure you're using a lower SDK (like 4.30.00.06 added above) and then you'll see the uartecho project, as seen in the image below:



Super Loop/Infinite Loop Embedded Systems

Most personal computers have an operating system that maintains central control; it executes programs by giving them momentary control and then resumes control when the program ends. Most embedded microcontrollers, however, don't have a central operating system.

There are two common models in embedded systems: using a "super loop" or using a Real Time Operating System (RTOS). In the super-loop model, there is a main loop which is an infinite loop and, once initialization is complete, the program loops indefinitely, servicing various functions. 

You can read more about "The 'Super Loop' Architecture for Embedded C programming" here: https://www.includehelp.com/c/the-super-loop-architecture-for-embedded-c-programming.aspx

This is usually implemented as a while loop using a while(1) type construct. Since many embedded systems are event driven, they wait for events to indicate something has happened. These events are usually handled by hardware interrupts.

In such super-loop systems, also called bare-metal systems, every task is coded inside the infinite loop except the interrupts. Thus, an embedded system microcontroller like this will execute each task in its infinite loop sequentially until there is an interrupt event.

You can read more about "Bare-metal and RTOS Based Embedded Systems" here: https://microcontrollerslab.com/difference-bare-metal-and-rtos-based-embedded-systems/

The timer, on the other hand, is going to be globally watching over the whole system to check for interrupts (e.g., you pushing one of the physical buttons).

The timerCallback() is used as the timer interrupt callback function and is set via params.timerCallback = timerCallback;. It will be called every time the timer reaches the countdown set with params.period. Code can be added here for anything that needs to be done on a regular interval or after a certain amount of time.

In general, the firing of the abstract timer button for this global timer is decided by the timer flag. First, a global (volatile) variable is set to FALSE, which says the abstract button is off. Then, when the callback function is executed, the abstract "button" is set to on by setting the TimerFlag variable to TRUE. At the end of the switch statement, the timer is set back to OFF, so that this cycle can continue.

If you get an error for the TimerFlag's call complaining about it being undefined, then it was probably not declared as volatile. The TimerFlag needs to be initialized early on as a volatile variable. This should look something like this:

volatile unsigned char TimerFlag = 0;

This initializes the TimerFlag to false. Then, in the callback function, the TimerFlag volatile variable should be set to true, which will then tell the timer to start monitoring interrupts. Remember, you can directly use bool values (preferred via the stdbool.h header), or the integer values of 1 and 0, to set a variable to true or false.

In addition, if you add actual hardware control code directly to the callback/interrupt (like readTemp()), it might cause problems like not being able to read more than a single value or the system hanging on the interrupt; as such, it's better to have the timer dedicated to setting a timer flag and then having your main control/implementation code called from main() while loop that checks the timer flag.


Here are some additional helpful links about embedded systems and super-loop approaches:


And here is a great resource for learning more about timers: https://embeddedinventor.com/embedded-timers-their-types-and-applications/


Using the COM Port

If you're on a Linux or Mac system, you can identify your COM port by doing the following:

ls /dev/tty*

which should give you something like this:

Once you connect your board and load the drivers for the COM port, it should show you the additional ports, as follows:

You might have to guess which port is the correct one but it should be one of the two new ports; e.g., it is the usbmodemE00810101 above in this case. You can use the Debug mode again for the Serial COM Port component in the uartecho project:

This will then let you use the Target → Connect COM port, as follows:

Printing to console

You can then use one of the following approaches to print to the console:

In general, in order to debug to the console, you can:

You can also use the UART to do so as above, of course.

 

Suggestions

If you're having issues with printing to the console, I'd recommend doing the simple puts() example here:


Tips for Using Printf: What is C I/O?: Getting C I/O working / Troubleshooting


I'd also recommend checking the stack and heap sizes, etc., as mentioned here:


Return Key

If you want to simulate the return key, on the TI Boards, it seems to be '\r' whereas, on other boards, it's different. E.g., on the stm32 nucleoboards, it seems to be '\0':

Some Common Errors

If you run into issues with the board itself, here are some troubleshooting steps that might prove helpful:

In general, you can try the above nominal fixes but, if they don't work, I'd recommend contacting TI Tech Support before attempting more significant hardware manipulations as some changes might render the board unusable.

Finally, if you receive the dreaded, "Error connecting to the target: (Error -1170)" and get the "Unable to access DAP" error, a simple fix might be to downgrade your CCS SDK to a version below 4.40. Starting with CC32xx SDK 4.40, SysConfig ImageCreator support was added in to give the same ImageCreator functionality from the UniFlash tool but if there's a misconfiguration or an issue with it, you can exclude image.syscfg from the build or, to make the change permanent and keep the newer version of the CCS, you can go to the project properties and switch from the MCU+Image to the Debug build configuration, as well. The .cfg contains the configuration for TI-RTOS while the .syscfg has configuration for drivers and some software stacks.

I might recommend ensuring the board is still in a stable state, as well, though. In general, the SOP should be in 010 but it's possible the board came mis-configured or there was another hardware issue. In our class, we don't change the hardware components, other than pressing buttons on the board, so I'd highly recommend contacting the TI Tech Support (you can chat with them 24/7 via chat or email) and they can either help zero in on the issue or replace the board, as needed (I know others in our class had to have their boards replaced this term, as well)!

Some Additional Errors

Once you install CCS and import the pwmled2 project, you should ensure your board works and can connect to CCS. If you instead receive an error, perhaps like 'SC_ERR_PATH_BROKEN', you should call TI customer support and, if they can't help fix it, then it's likely due to a broken board which needs to be replaced.

Once the board is connected and runs the test program, you can start to make changes. If, after making changes, you get an error like:

Error connecting to the target:

(Error -1170 @ 0x0)

Unable to access the DAP. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK).

(Emulation package 7.0.48.0)

This error usually indicates that communication was lost between the IDE and the microcontroller. This likely happens with the pwmled2 program as it has an infinite while loop so if you make a change, you have to first stop the board or reset it. In addition, if you use Debug, you have to ensure you're stopping that, as well.

Here are some troubleshooting steps to help; please try to:

In general, you can try the above nominal fixes but, if they don't work, I'd recommend contacting TI Tech Support before attempting more significant hardware manipulations as some changes might render the board unusable.

The other things to try (with great care!) are as follows:

Nota Bene: although the SOP should, in general, be in 010 it's possible the board came mis-configured or with another hardware issue. In our class, we don't change the hardware components (other than pressing buttons on the board) so I'd highly recommend contacting the TI Tech Support (you can chat with them 24/7, I believe) and they can either help zero in on the issue or replace the board, as needed (I know others in our class had to have their boards replaced this term, as well)!