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.

TMS320F28379D: GPIO Configuration and Project Layout

Part Number: TMS320F28379D


Hello all,

I am fairly new to the C2000 and it's been a bit of a learning curve compared with the much simpler MSP430 that I learned on! Anyway....

I have started off using the ePWM_deadband example. I have then removed much of the functionality from main() and placed it into a configPWM() function in a header called ePWM_Config and I call that from main(). I would like to do something similar to configure the ADCs, GPIO and SPI to enable me to have a very simple main() function with all the peripherals setup by a dedicated header file that I can go and modify. My first question is whether this is a good approach and is there a convention for laying out projects? I am assuming I should leave the TI example files like "F2837xD_EPwm.c" well alone and then call my own setup function after they have been called and it has done all the background configuration?

My second issue is that I am a bit concerned about setting the purpose of I/O pins in different header files. It would be good to have a single header file that configured all of the pins one after the other. For example, I would like a file where I set up the function of every GPIO pin, for example setting one up as ePWM1A, but then leave the setting up of the ePWM module for a dedicted function elsewhere. I seem to recall that when I used the F28069M on a previous project there was a header file which listed every pin and then you could comment out sections to assign that pin to a particular peripheral or leave it as GPIO. Is this an option for the F28379D as all the examples seem to focus on one peripheral each and they just set up the pin function in main().

Apologies for the vague questions but I am trying to get into good habits from the start to avoid issues later.

  • Euan,

    Are you using DriverLib examples? C2000ware comes with bunch of examples. The implementation of functionality is encapsulated inside the library, and it exposes lot of APIs for application to control it. It is recommended for new project.

    You can import the project in your workspace, and then start modifying the code as per your coding convention. 

  • Hi,

    Thanks for your reply. I am not using the DriverLib. I prefer to use the bitfield as I find it a bit easier since I can go through each of the registers for the peripheral and think about each bit. I learned the basics with C and Assembler on an MSP430 so I like to think in 1s and 0s in registers where possible.

    I started from the Bitfield ePWM deadband example as it was closest to what I wanted to achieve and I have been modifying from there. The examples are great for each individual peripheral but I'm just trying to develop a sensible convention when I start to use more than one peripheral per project. Do you have anything like a zip file of a larger project that shows how the code is divided up and which headers are included where? I would find it really useful to have an example of how an expert would lay out a more complex project with lots of peripherals in use!

  • Hi,

    I am attaching one of the example here which is bitfield based. In this example, there is a separate file for each peripheral. You can use that as reference

    hrcap_ex1_capture_bitfield.zip