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.

Hercules RM48L952 Pulse Capture HalCoGen Function triggers exception

Other Parts Discussed in Thread: HALCOGEN, CODECOMPOSER

Hi. We are using the Hercules RM48L942 with HalCoGen generated function capGetSignal(hetRAMBASE_t * hetRAM, uint32 cap, hetSIGNAL_t signal). We are using the Micrium OSII on top of the HalCoGen drivers.  When we call the capGetSignal function, writing to the signal->duty and signal->period triggers an ARM exception. Is there some type of lock on accessing this signal? Even just simple test of trying to create a   hetSIGNAL_t structure and writing to the period and duty fields triggers the exception. Is there a HalCoGen function we need to call before being able to use the capGetSignal function?  Thank you.

/** @fn void capGetSignal(hetRAMBASE_t * hetRAM, uint32 cap, hetSIGNAL_t signal)

* @brief Get capture signal

* @param[in] hetRAM Pointer to HET RAM:

* - hetRAM1: HET1 RAM pointer

* - hetRAM2: HET2 RAM pointer

* @param[in] cap captured signal:

* - cap0: Captured signal 0

* - cap1: Captured signal 1

* - cap2: Captured signal 2

* - cap3: Captured signal 3

* - cap4: Captured signal 4

* - cap5: Captured signal 5

* - cap6: Captured signal 6

* - cap7: Captured signal 7

* @param[in] signal signal

* - duty cycle in %.

* - period period in us.

*

* Gets current signal of the given capture signal.

*/

/* SourceId : HET_SourceId_013 */

/* DesignId : HET_DesignId_013 */

/* Requirements : HL_SR377 */

void capGetSignal(hetRAMBASE_t * hetRAM, uint32 cap, hetSIGNAL_t *signal)

{

uint32 pwmDuty = (hetRAM->Instruction[(cap << 1U) + 25U].Data) >> 7U;

uint32 pwmPeriod = (hetRAM->Instruction[(cap << 1U) + 26U].Data) >> 7U;

signal->duty = (pwmDuty * 100U) / pwmPeriod;

if( hetRAM == hetRAM1)

{

signal->period = ((float64)pwmPeriod * 1280.000F) / 1000.0F;

}

else

{

signal->period = ((float64)pwmPeriod * 1280.000F) / 1000.0F;

}

}

  • Are you calling the het init function?

    Also, just so you know, the first reading from capGetSignal returns garbage data. capGetSignal also only updates the period/duty cycle on an edge, so if you call capGetSignal repeatedly it will tell you the last previously read value, until a new edge is seen, and then it will update its measurement.
  • Hi. thank you. Yes we called initHET (we have some nhet's pins configured as PWM, and this works ok). We wanted 3 to be pulse capture pins. When we called the HalCoGen autogenerated capGetSignal function and singlestepped with CodeComposer debugger - when we got to the code in the function
    signal->duty = (pwmDuty * 100U) / pwmPeriod;

    the ARM exception gets triggered. We did a simple test and trying writing to signal->duty or signal->period, triggers always triggers the exception. Was there more in HalCoGen NHET tab we should have done to insure these pins are properly unlocked to be used as (input Pulse Capture Pins (not output PWM), and that the signal halCoGen structure is writable by the HalCoGen capGetSignal autogenerated function?
  • In Halcogen under the HET Pin tabs, you need whatever pins you are using to capture set as input with HR Share selected. You also need to go to the Cap tab and set a Cap for each input pin you are using, and then pass that cap number to capGetSignal.

  • Hi. Thank you. I am in HalCoGen Now (version 04.03.00) -> HET1 -> CAP... can you just screen shot one practical example on one pin of the steps you mean above? Thank you again.
  •  So when you call capGetSignal, for this example, you would pass 0 in for the cap variable.

  • Hi Thank you. Set up all 3 pins as above. Ran with debugger. same line in HalCoGen function generating the same ARM Data Abort exception(0x00000010) on Interrupts tab in HalCoGen. Does the RM48 require that there is actually hardware connected/running at all times to these pins before running a test, to capture signal > 0?