ECAT_SSC: Uninitialized gpio_config stack variables in HW_Init()

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

cross mob
User15064
Level 1
Level 1
It looks like there is a bug in the HW_Init code in "Dave/Generated/ECAT_SSC/xmc_eschw.c"

The gpio_config and port_control structures are not being fully initialized. This results in the gpio_config.output_level variable being assigned a random stack value.
When gpio_config.output_level is used to initialize the ECAT gpios in XMC_GPIO_Init() it assigns garbage stack values into the OMR register.

port->OMR = (uint32_t)config->output_level << pin;

UINT16 HW_Init(void)
{
uint8_t i;
XMC_ECAT_PORT_CTRL_t port_control;
XMC_GPIO_CONFIG_t gpio_config;

memset(&port_control, 0, sizeof(port_control)); // <-- add this line
memset(&gpio_config, 0, sizeof(gpio_config)); // <-- add this line

============================
DAVE Version: 4.4.2
ECAT_SSC APP Version: 4.0.22
0 Likes
1 Reply
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

Thanks for the feedback we will correct it in the next release.

Regards,
Jesus
0 Likes