Common Errors

If your code compiles but it does not do what you expect it to do, you need to debug it. This means you need to step through your code especially in the areas where you suspect the problem is happening. 

You can find the link for how to debug using CCS here.

There are some common mistakes that account for more than 90% of the errors we have seen students make in this class. Here is a list of common errors:


If you are unable to push your project to GitHub, then in most cases, you have somehow changed the GitHub repository and it is not in sync with your local repository. To fix this you need to follow instructions on this page


If you find that your code works when it is written in the main() function but stops working it is moved to another function, check if your code accesses peripherals like the display, UART, timer, etc. Most of the peripheral HAL functions take the pointer to the peripheral as an input. Hence, your new function needs to be written as a call-by-reference, i.e., it should take the pointer to the peripheral as an input parameter, and use this pointer as the input to the peripheral HAL function.

If one or more variables gets updated in the function, and this updated variable gets used in the main (or another function), the function should be a call-by-reference type, i.e., the new function should operate on the pointers to the variables which need to be updated.

Remember to dereference a pointer to access it's value.