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.

TMS570LS1227: need to implement a 100khz interrupt to call a routine

Part Number: TMS570LS1227
Other Parts Discussed in Thread: HALCOGEN

Hi,

I am new to the Hercules mcu and I've been handed a project that was started by another engineer that has left the business.

The design was started using the HALCoGen application, so there are alot of references to it within the code.

I have to retrofit a 100kHz interrupt based (I assume) on the RTI, so that it calls a function that uses a look-up table to to pick points to make a waveform.

At the moment the waveform is a sinewave made of 72 points, however the waveform doesn't have to be a sinewave.

We are using the dmaBTCAInterupt to do block transfers, and I've incorporated the look-up code within it and I'm able to get a sine wave with a max freq of 45Hz

I have the following questions:

1) can I increase the speed of the current interrupt to 100kHz ( can block transfers happen that quickly, as I believe the BTC interrupt is called once done);

2) can I retro-fit an interrupt to the existing code so that it calls the look-up routine with/without the help of the HALCoGen;

3) can HALCoGen be used to reconfigure or understand the current configuration of the MCU after the autogen code has been edited? 

Regards,

Adam

  • Hello Adam,

    1. It depends on the block size of your data. You can measure how many cycles it will take to transfer your data from SRAM to SRAM using MPU or by toggling one GPIO. It won't take more than 10us for only transferring only 72 samples.

    2. Yes, you can change the period manually by calling the RTI API:
    rtiSetPeriod(rtiBASE_t *rtiREG, uint32 compare, uint32 period);

    or writing the new value to the register directly:
    rtiREG->CMP[compare].UDCPx = period;

    3. You must only insert your user code inside the predefined /* USER CODE BEGIN */ and /* USER CODE END */ or otherwise your custom code will disappear after you regenerate HalCogen.
  • Hi QJ Wang,

    Thanks for getting back to me.

    2) I think the RTI timer use is split between ethernet comms and as a debug timer for time profiling of ADC/resolver and DMA code.

    I would like to repurpose the second function from timing and attach an interrupt to it. Is there any template code that I can drop in?

    My current rti.c& sys_vim.c files

    2376.rti.c

    4466.sys_vim.c

    3) I don't have the orignal *.dil file for HALCoGen to reopen the project. Is there a way to import existing code so that HALCogen can generate the diagrams?

    Thanks,

    Adam