[S32K324] how to set ethernet VLAN ID in S32DS?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

[S32K324] how to set ethernet VLAN ID in S32DS?

跳至解决方案
1,765 次查看
Ethan_L
Contributor III

Hi community,

I want to set ethernet VLAN ID on S32K324, but I can not find any information in LWIP example and S32DS peripherals UI.

Is there any example or document about how to set ethernet VLAN ID?

Thanks,

Ethan.

0 项奖励
回复
1 解答
1,742 次查看
namnguyenviet
NXP Employee
NXP Employee

Hello @Ethan_L 

To send a VLAN frame, you can add VLAN tag into the frame array before calling Ethernet frame sending service. Something like below:

VlanTag[0U] = 0x81U;    /*TPID = 0x8100 */

VlanTag[1U] = 0x00U;

VlanTag[2U] = 0x00U;

VlanTag[3U] = 0x05U;

/* add vlan tag */

for (frameByteIdx = 12U; frameByteIdx < 16U; frameByteIdx++) {

        txBuff.data[frameByteIdx] = VlanTag[frameByteIdx%12U];

}

status = Gmac_Ip_SendFrame(instance, ring, &txBuff, NULL_PTR);

Best Regards,

Nam

在原帖中查看解决方案

1 回复
1,743 次查看
namnguyenviet
NXP Employee
NXP Employee

Hello @Ethan_L 

To send a VLAN frame, you can add VLAN tag into the frame array before calling Ethernet frame sending service. Something like below:

VlanTag[0U] = 0x81U;    /*TPID = 0x8100 */

VlanTag[1U] = 0x00U;

VlanTag[2U] = 0x00U;

VlanTag[3U] = 0x05U;

/* add vlan tag */

for (frameByteIdx = 12U; frameByteIdx < 16U; frameByteIdx++) {

        txBuff.data[frameByteIdx] = VlanTag[frameByteIdx%12U];

}

status = Gmac_Ip_SendFrame(instance, ring, &txBuff, NULL_PTR);

Best Regards,

Nam