cancel
Showing results for 
Search instead for 
Did you mean: 

SPC564B74 - eMIOS ICU limited to 10ch?

aurelien23
Senior
Posted on September 03, 2015 at 10:49

Hello,

On SPC5Studio V3.6 and SPC564B74. I would like to use ICU eMIOS_0 ch. 9 (PA[9], E0UC[9]) but eMIOS ICU config in HAL layers is only listing ch. 0 to 7 and ch.24. It should lists ch.1 to 7 and 9 to 15 on eMIOS_0 and ch.9 to 15 on eMIOS_1 according to reference manual, right?

If you confirm the issue, can you please advise on which files should be modified?

Please see screenshots below.

Thanks,

Aurélien

0690X00000604tfQAA.png

0690X00000604wrQAA.png
This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
2 REPLIES 2
Erwan YVIN
ST Employee
Posted on September 03, 2015 at 17:25 Hello Aurelien , for ICU , eMIOS HAL point of view has been limited from Channel 0 to Channel 7 and Channel from the RM, you can use ICU from channel 0 to Channel 31 by SAIC (Single Action Input Capture) for PWM , eMIOS HAL point of view from Channel 8 to Channel if you want to use eMIOS ICU , i advice you to update icu_lld.c. (cf below)

#if SPC5_ICU_USE_EMIOS0_CH8
/* Driver initialization.*/
icuObjectInit(&ICUD9);
ICUD9.emiosp = &EMIOS_0;
ICUD9.ch_number = 9U;
ICUD8.clock = SPC5_EMIOS0_CLK;
#endif /* SPC5_ICU_USE_EMIOS0_CH7 */

#if SPC5_ICU_USE_EMIOS0_CH0
if

(&ICUD1 == icup)
increase_emios0_active_channels();
#endif /* SPC5_ICU_USE_EMIOS0_CH0 */
#if SPC5_ICU_USE_EMIOS0_CH1
if

(&ICUD2 == icup)
increase_emios0_active_channels();
#endif /* SPC5_ICU_USE_EMIOS0_CH1 */
#if SPC5_ICU_USE_EMIOS0_CH2
if

(&ICUD3 == icup)
increase_emios0_active_channels();
#endif /* SPC5_ICU_USE_EMIOS0_CH2 */
#if SPC5_ICU_USE_EMIOS0_CH3
if

(&ICUD4 == icup)
increase_emios0_active_channels();
#endif /* SPC5_ICU_USE_EMIOS0_CH3 */
#if SPC5_ICU_USE_EMIOS0_CH4
if

(&ICUD5 == icup)
increase_emios0_active_channels();
#endif /* SPC5_ICU_USE_EMIOS0_CH4 */
#if SPC5_ICU_USE_EMIOS0_CH5
if

(&ICUD6 == icup)
increase_emios0_active_channels();
#endif /* SPC5_ICU_USE_EMIOS0_CH5 */
#if SPC5_ICU_USE_EMIOS0_CH6
if

(&ICUD7 == icup)
increase_emios0_active_channels();
#endif /* SPC5_ICU_USE_EMIOS0_CH6 */
#if SPC5_ICU_USE_EMIOS0_CH7
if

(&ICUD8 == icup)
increase_emios0_active_channels();
#endif /* SPC5_ICU_USE_EMIOS0_CH7 */
#if SPC5_ICU_USE_EMIOS0_CH24
if

(&ICUD9 == icup)
increase_emios0_active_channels();
#endif /* SPC5_ICU_USE_EMIOS0_CH24 */
#if SPC5_ICU_USE_EMIOS1_CH24
if

(&ICUD10 == icup)
increase_emios1_active_channels();
#endif /* SPC5_ICU_USE_EMIOS1_CH24 */

and add the matching handler for channel 8 and channel 9

/**
* @brief eMIOS0 Channels 6 and 7 interrupt handler.
* @note It is assumed that the various sources are only activated if the
* associated callback pointer is not equal to @p NULL in order to not
* perform an extra check in a potentially critical interrupt handler.
*
* @isr
*/
OSAL_IRQ_HANDLER(SPC5_EMIOS0_GFR_F6F7_HANDLER) {
OSAL_IRQ_PROLOGUE();
#if SPC5_ICU_USE_EMIOS0_CH6
icu_lld_serve_interrupt(&ICUD7);
#endif
#if SPC5_ICU_USE_EMIOS0_CH7
icu_lld_serve_interrupt(&ICUD8);
#endif
OSAL_IRQ_EPILOGUE();
}
#endif /* SPC5_ICU_USE_EMIOS0_CH6 || SPC5_ICU_USE_EMIOS0_CH7 */

Best regards Erwan
aurelien23
Senior
Posted on September 07, 2015 at 17:34

Ok, but I will still have to modify mcuconf.h to declare:

#define SPC5_ICU_USE_EMIOS0_CH9             TRUE

and this files is overwritten at each code generation.