2022-12-14 01:55 AM
I tried to initialize test channels on SARADC_B (supervisor).
/* Channels Configurations (DMA is not used)*/
static channelConfig _saradcconf_ch_configs[SPC5_SARADC_MAX_NUMOFCHANNELS] =
{
{SARADC_CHANNEL_TEST, 96U,SARADC_REFERENCE_DEFAULT, SARADC_PRECHARGE_ENABLED, SARADC_CTR0, SARADC_WATCHDOG_REGISTER_NONE,NULL},
{SARADC_CHANNEL_TEST, 97U,SARADC_REFERENCE_DEFAULT, SARADC_PRECHARGE_ENABLED, SARADC_CTR0, SARADC_WATCHDOG_REGISTER_NONE,NULL},
{SARADC_CHANNEL_TEST, 98U,SARADC_REFERENCE_DEFAULT, SARADC_PRECHARGE_ENABLED, SARADC_CTR0, SARADC_WATCHDOG_REGISTER_NONE,NULL},
{SARADC_CHANNEL_TEST, 99U,SARADC_REFERENCE_DEFAULT, SARADC_PRECHARGE_ENABLED, SARADC_CTR0, SARADC_WATCHDOG_REGISTER_NONE,NULL},
{0U, 0U, 0U, 0U, 0U, 0xFFU, NULL}, /* Channel Configuration Unused 4 */
{0U, 0U, 0U, 0U, 0U, 0xFFU, NULL}, /* Channel Configuration Unused 5 */
};
/**
* @brief Structure defining the configuration "saradcconf".
*/
SARADCConfig saradc_config_saradcconf = {
/* conversion mode */
SARADC_MODE_ONESHOT,
/* Trigger Mode */
SARADC_TRIGGER_DISABLED,
/* CTR registers configuration (CRES,PRECHG,INPSAMP) */
{
/* CTR0 */ {SARADC_CRES_HIGH, 1U, 100U},
/* CTR1 */ {SARADC_CRES_HIGH, 1U, 100U},
/* CTR2 */ {SARADC_CRES_HIGH, 1U, 100U},
/* CTR3 */ {SARADC_CRES_HIGH, 1U, 100U},
},
/* No DMA configuration */
FALSE,
{0U, 0U, 0U, 0U, 0U, 0U, 0U},
NULL,
/* Channels Configurations */
_saradcconf_ch_configs,
/* Number of channels */
4U,
/* Conversion callback */
saradcconf_conv_cb,
/* No analog watchdog configured */
{
{(float)0,(float)0},
},
(float)0,
0U,
};
saradc_lld_start(&SARADC12DSV, &saradc_config_saradcconf);
While debugging I realized it goes to '.unhandled_exception2' when I tried to set TCDR[x].B.PCE (precharge bit.)
I tried to set all precharge disabled and enabled, but it still not working.
Here are some screenshots from debug view.
2022-12-14 05:18 AM
Hello ,
Which compiler do you use ?
Could you try to compile this part of code in -O0 ?
Best Regards
Erwan
2022-12-14 05:46 AM
I use FreeGCC.
I already built with -O0