Other Parts Discussed in Thread: HALCOGEN
Hi,
It seems that HALCoGen produces wrong code when configured as 10 or 8 bit ADC with including the channel id.
The bug is in the function "adcGetData":
if(mode == ADC_12_BIT)
{
......
}
else
{
/** - Get conversion data and channel/pin id */
for (i = 0U; i < count; i++)
{
buf = adc->GxBUF[group].BUF0;
/*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
ptr->value = (uint16)(buf & 0x3FFU);
ptr->id = (uint32)((buf >> 10U) & 0x1FU);
ptr++;
}
}
The bold 10 is wrong. The channel ID is always at the same location. It should be:
ptr->id = (uint32)((buf >> 16U) & 0x1FU);