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.

Register Callback Mechanism

Other Parts Discussed in Thread: C2000WARE, TMS320F28335

I've been trying to get used TI series uC. When I reviewed interrupt handling. uC offer callback notification functions 

to allow implementing user design functions. Writing user codes into these functions breaks top-down design and 

create circular dependency. I wonder that are there any register callback function in order to call our custom designed callback from application layer to low layers.

  • Hi,

    In order to get you connected with the right expert, could you provide some more information?

    * What device are you having issues with? For example F28004x, MSP430x, etc.

    * What software are you having an issue with? For example: driverlib, C2000Ware, compiler, CCS, etc.

    * What peripheral are you having an issue with? For example: ePWM, ADC, SPI, etc.

    With the current information, this is unfortunately too vague to involve an expert in.

    Please provide as much information as possible.

    Thank you!

    Regards,

    Vince

  • Hi,

    I am currently using TMS320f28335 from C2000 family. What I've seen so far there is no code generator GUI or firmware support except peripherals examples. I am using CCS, and also C2000ware. For now, I am interested in CAN peripherals.

  • Hi,

    Thanks for the follow up information.

    This is unfortunately a bit general, but I think I can help point you in the right direction!

    C2000 devices actually do have a similar functionality to what you are describing. When an interrupt occurs, the ISR begins execution, but the content of the ISR itself is actually located in another function (which is called as part of the interrupt). The pointer to this actual ISR function is assigned ("registering the callback" as you described) using our PIE vectors.

    This provides a HAL between the application and drivers/peripherals.

    Please see the "Peripheral Interrupt Expansion (PIE)" section within the "System Control and Interrupts" chapter of the device TRM (linked here). This should provide a very in-depth look at the high-level call-back functions of the devices.

    For an even more detailed look at the interrupt architecture's abstraction layers, please see the "CPU Interrupts and Reset" chapter of the C28x CPU and Instruction Set guide (linked here). This goes into detail on the hardware (and SW layers above it) of the interrupts/callbacks.

    If you have a more specific question related to an example, or a specific IP, please feel free to post another thread!

    Regards,

    Vince

  • Hi Vince, 

    I decided to create a HAL library to increase reusability. TI does not offer any HAL library solution for F2833x devices. I only have

    #include "DSP2833x_Device.h" this file which includes register file structure definition, but I have to problem here when I started to build gpio library.

    For example: If I want to create a function like

    GPIO_WritePin(port_t PORTx, uint16_t GPIOx)

    I cant do that because of nested register file structure build such as 

    extern volatile struct GPIO_CTRL_REGS GpioCtrlRegs;
    extern volatile struct GPIO_DATA_REGS GpioDataRegs;
    extern volatile struct GPIO_INT_REGS GpioIntRegs;

    These registers hold all port definitions together inside of own selves. And I could not parse and acces them seperately.

    Would you give me any advice to handle this ? 

  • Hi Ismail,

    Yes, there is no driverlib/HAL for F2833x devices. You can refer to the examples provided within C2000Ware for F2833x to understand how to use the structure definition. For GPIO, you can refer to <C2000WareInstallDir>\device_support\f2833x\examples\gpio_toggle.

    Best Regards

    Siddharth