XMC1300 CPU Card ADC Conversion Issue

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User11506
Level 2
Level 2
Hi again everybody,

I am playing with the XMC1300 VADC peripheral using the XMC1300CPU board and I have some issues maybe you can help me with.

I am trying to read the voltage at the pin P2.5. Which corresponds to Group1, Channel 7.

I am using a queue source, with external trigger and refil.

In order to do this I have used the Application Note AP32304, point 2.4, with a small change,

instead of using the service request SR2 from CCU4 (REQTRA), I am using the service request SR2 from CCU8 (REQTRI).

The problem is that re result register is always 0, so I must be doing something wrong.

In first place I have to mention that the CCU8 is working well, and the PWM signals I measure with the oscilloscope are the expected ones.

This is how I have configured the unit CCU8 to generate SR2 :

XMC_CCU8_SLICE_EnableEvent(CCU80_SLICE0_PTR, XMC_CCU8_SLICE_IRQ_ID_PERIOD_MATCH);
XMC_CCU8_SLICE_EnableEvent(CCU80_SLICE0_PTR, XMC_CCU8_SLICE_IRQ_ID_ONE_MATCH);

XMC_CCU8_SLICE_SetInterruptNode(CCU80_SLICE0_PTR, XMC_CCU8_SLICE_IRQ_ID_PERIOD_MATCH, XMC_CCU8_SLICE_SR_ID_0); //Used for interrupt
XMC_CCU8_SLICE_SetInterruptNode(CCU80_SLICE0_PTR, XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_UP_CH_1, XMC_CCU8_SLICE_SR_ID_2); //used to trigger the conversion


NVADC is configured acoordint to AP32304 as following :

XMC_VADC_GLOBAL_CONFIG_t vadc_global_handle = {};
XMC_VADC_GROUP_CONFIG_t vadc_group_handle = {};

XMC_VADC_QUEUE_CONFIG_t vadc_queue_handle =
{
.trigger_signal = XMC_VADC_REQ_TR_I, //Corresponds to SR2 generated by CCU80
.trigger_edge = XMC_VADC_TRIGGER_EDGE_ANY,
.external_trigger = 1
};

XMC_VADC_CHANNEL_CONFIG_t vadc_g1_ch7_handle = {
.alias_channel = XMC_VADC_CHANNEL_ALIAS_DISABLED,
.result_reg_number = 7, };

XMC_VADC_QUEUE_ENTRY_t queue_entry_0_handle =
{
.channel_num = 7,
.refill_needed = 1,
.generate_interrupt = 0,
.external_trigger = 1,
};

XMC_VADC_GLOBAL_Init(VADC, &vadc_global_handle);
XMC_VADC_GROUP_Init(VADC_G1, &vadc_group_handle);
XMC_VADC_GROUP_SetPowerMode(VADC_G1,XMC_VADC_GROUP_POWERMODE_NORMAL);
XMC_VADC_GLOBAL_StartupCalibration(VADC);
XMC_VADC_GROUP_QueueInit(VADC_G1, &vadc_queue_handle);
XMC_VADC_GROUP_ChannelInit(VADC_G1, 7, &vadc_g1_ch7_handle); //Corresponding to the pin P2.5
XMC_VADC_GROUP_QueueInsertChannel(VADC_G1, queue_entry_0_handle);
while(1)
{


ADC_RESULT = XMC_VADC_GROUP_GetResult(VADC_G1,7);

}

Anybody sees anything wrong?

Thank you for your help!
0 Likes
1 Reply
User11506
Level 2
Level 2
Dear all,

I eventually answered my self, and, as sometimes happens in these cases, the mistake is quite obvious 😄

I missed to enable the event generation for CH1 Compare Match while Counting Up as follows:

XMC_CCU8_SLICE_EnableEvent(CCU80_SLICE0_PTR, XMC_CCU8_SLICE_IRQ_ID_PERIOD_MATCH);
XMC_CCU8_SLICE_EnableEvent(CCU80_SLICE0_PTR, XMC_CCU8_SLICE_IRQ_ID_ONE_MATCH);
XMC_CCU8_SLICE_EnableEvent(CCU80_SLICE0_PTR, XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_UP_CH_1); // Missing Part

Have a nice day ! 🙂
0 Likes