OPCUASERVER_LWIP_XMC47 on xmc4800 automation board

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

cross mob
User16529
Level 4
Level 4
First solution authored
Hi!
I'm testing the opc ua server example OPCUASERVER_LWIP_XMC47 on my xmc4800 automation board, but the server doesn't start. In the function opcua_init the both UAServer_Generate_certificate() and UAServer_Start(0) functions cause a break in the code and the result is that i'm unable to ping the borad and there is no server running on it.
If i comment the two functions I can ping the board but, of course, there is no server on it. How come?
I'll appriciate any advise
0 Likes
2 Replies
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

I just tested the example in the XMC4700 RelaxKit and there it is working without problems.

4079.attach

In the Libraries/lwip/port/nosys/netif/ethernetif.c you need to adapt the pins as follows:

#define RXD1     P14_9
#define RXD0 P14_8
#define RXER P0_11
#define CLK_RMII P15_8
#define TX_EN P5_9
#define TXD1 P2_13
#define TXD0 P2_12
#define CRS_DV P15_9
#define MDIO P1_11
#define MDC P1_10


low_level_init(struct netif *netif)
{

port_control.mode = XMC_ETH_MAC_PORT_CTRL_MODE_RMII;
port_control.rxd0 = XMC_ETH_MAC_PORT_CTRL_RXD0_P14_8;
port_control.rxd1 = XMC_ETH_MAC_PORT_CTRL_RXD1_P14_9;
port_control.clk_rmii = XMC_ETH_MAC_PORT_CTRL_CLK_RMII_P15_8;
port_control.crs_dv = XMC_ETH_MAC_PORT_CTRL_CRS_DV_P15_9;
port_control.rxer = XMC_ETH_MAC_PORT_CTRL_RXER_P0_11;
port_control.mdio = XMC_ETH_MAC_PORT_CTRL_MDIO_P1_11;
XMC_ETH_MAC_SetPortControl(&eth_mac, port_control);

XMC_ETH_MAC_Init(&eth_mac);

XMC_ETH_MAC_DisableJumboFrame(&eth_mac);

gpio_config.output_level = XMC_GPIO_OUTPUT_LEVEL_LOW;
gpio_config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE;
gpio_config.mode = (XMC_GPIO_MODE_t)((uint32_t)XMC_GPIO_MODE_OUTPUT_PUSH_PULL |P2_12_AF_ETH0_TXD0);
XMC_GPIO_Init(TXD0, &gpio_config);

gpio_config.mode = (XMC_GPIO_MODE_t)((uint32_t)XMC_GPIO_MODE_OUTPUT_PUSH_PULL | P2_13_AF_ETH0_TXD1);
XMC_GPIO_Init(TXD1, &gpio_config);

gpio_config.mode = (XMC_GPIO_MODE_t)((uint32_t)XMC_GPIO_MODE_OUTPUT_PUSH_PULL | P5_9_AF_ETH0_TX_EN);
XMC_GPIO_Init(TX_EN, &gpio_config);

gpio_config.mode = (XMC_GPIO_MODE_t)((uint32_t)XMC_GPIO_MODE_OUTPUT_PUSH_PULL | P1_10_AF_ETH0_MDC);
XMC_GPIO_Init(MDC, &gpio_config);

XMC_GPIO_SetHardwareControl(MDIO, XMC_GPIO_HWCTRL_PERIPHERAL1);

}
0 Likes
User16529
Level 4
Level 4
First solution authored
Hi,
my configuration is the same you've suggested, but the server doesn't start. I'm running the code in the XMC4800 automation board v2 and not in the relax kit. Could they be so different from each other that the server couldn't run?

The code is stuck inside the function UAServer_Start(0) in the opcuaserver_raw/opcua_server.c

void opcua_init(void)
{
UA_Status_t status;

UA_SERVER_PRINTF("opcua_init()");

/* Initialise random number generator (seed is unimportant) */
srand(0);

status = UAServer_Initialise(&UA_CONFIGURATION);
if (status != 0)
{
while (TRUE)
;
}

UAServer_Time_emulation_enabled(TRUE);

{
uint8_t ip_address[4];
ip_address[0] = IP_ADDR0;
ip_address[1] = IP_ADDR1;
ip_address[2] = IP_ADDR2;
ip_address[3] = IP_ADDR3;
UAServer_Add_IP_address(ip_address);
}

{
char uri[100] = "uri://Dummy_uri";
UAServer_Set_URI(uri);
}

opcua_add_nodes();

UAServer_Generate_certificate();

UAServer_Start(0);

opcua_tcpip_init();
}
0 Likes