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.
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;
}
}
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.