How to communicate with PTP linux PC? Topic is solved

New to XMOS and XCore? Get started here.
etori90
Member
Posts: 8
Joined: Thu Sep 05, 2019 6:49 am

How to communicate with PTP linux PC?

Postby etori90 » Tue Jul 14, 2020 10:01 am

I downloaded PTP_server in TSN example on explorer 200 and connected with PTP linux PC.
But Xmos only send path_delay msg by perodic function ... can not process any received PTP msg..

So i thought like this

1. receiving port problem -> i tested for udp and http example and it works well
2. mac filter -> i found PTP msg filter is added in ptp_init function
3. using lwip -> I'm trying...



in main code:

on tile[1]: rgmii_ethernet_mac(i_eth_rx_lp, NUM_ETH_RX_LP_CLIENTS,
i_eth_tx_lp, NUM_ETH_TX_LP_CLIENTS,
c_eth_rx_hp, c_eth_tx_hp,
c_rgmii_cfg,
rgmii_ports,
ETHERNET_DISABLE_SHAPER);

on tile[1].core[0]: rgmii_ethernet_mac_config(i_eth_cfg, NUM_ETH_CFG_CLIENTS, c_rgmii_cfg);

on tile[1].core[0]: rtl8211f_phy_driver(i_smi, i_eth_cfg[MAC_CFG_TO_PHY_DRIVER]); <- I used another phy chip

on tile[0]: ptp_server(i_eth_rx_lp[MAC_TO_MEDIA_CLOCK_PTP],
i_eth_tx_lp[MEDIA_CLOCK_PTP_TO_MAC],
i_eth_cfg[MAC_CFG_TO_MEDIA_CLOCK_PTP],
c_ptp, NUM_PTP_CHANS, PTP_GRANDMASTER_CAPABLE);


void ptp_server(client interface ethernet_rx_if i_eth_rx,
client interface ethernet_tx_if i_eth_tx,
client interface ethernet_cfg_if i_eth_cfg,
chanend ptp_clients[], int num_clients,
enum ptp_server_type server_type)
{
timer ptp_timer;
int ptp_timeout;
ptp_server_init(i_eth_cfg, i_eth_rx, ptp_clients[0], server_type, ptp_timer, ptp_timeout);

while (1) {
select
{
case i_eth_rx.packet_ready():
printf("ptp_ptacket_ready");
ptp_recv_and_process_packet(i_eth_rx, i_eth_tx); <- can't enter function ... is this i_eth_rx.packet_ready problem? then, mac problem?
break; \
case (int i=0;i<num_clients;i++) ptp_process_client_request(ptp_clients, ptp_timer):
break;
case ptp_timer when timerafter(ptp_timeout) :> void:
ptp_periodic(i_eth_tx, ptp_timeout);
ptp_timeout += PTP_PERIODIC_TIME;
break;
}
}
}

I don't know what is the problem for this exam help me...................................pls
View Solution
nick
Member++
Posts: 16
Joined: Tue Jan 07, 2020 10:35 am

Postby nick » Tue Jul 21, 2020 7:47 am

Hi,
I'm interested in this application too.
As I understand there are two functions: ptp_server and gptp_media_clock_server (used by the AVB application note). The latter can be used to tune the master clock on the xmos board.
I tried to use both of them without any success.
Let me know if you did something new.
User avatar
akp
Respected Member
Posts: 428
Joined: Thu Nov 26, 2015 11:47 pm

Postby akp » Wed Jul 22, 2020 5:24 pm

Do you have a project that builds, I might be able to take a look. I have a fair amount of experience with gptp. Just to make sure, you have GPTP running on the linux machine?
etori90
Member
Posts: 8
Joined: Thu Sep 05, 2019 6:49 am

Postby etori90 » Thu Jul 23, 2020 4:21 am

I found this is layer problem so I set linux ptp to send L2 layer message ( sudo ptp4l -2 -P -i enterface -m)
first linux ptp send ptp message by two types
Both types have different destination address types , so you should add mac filter at ptp_server init function.

1. LLDP 0x01,0x80, 0xc2, 0x0, 0x0, 0xe ---sync. announce
2. IEEE....something 0x01,0x1b,0x19,0x00,0x00,0x00 ----peer to peer message(pdelay request, pdelay resposnse)

To enter the message processing function, we need to modify some conditions.

1.PTP_NEIGHBOR_PROP_DELAY_THRESH_NS
2.GET_PTP_TRANSPORT_SPECIFIC
3.PTP_DEFAULT_DEST_ADDR

at ptp_recv function .....at this line -> ptp_port_info[src_port].delay_info.pdelay <= PTP_NEIGHBOR_PROP_DELAY_THRESH_NS
I modified PTP_NEIGHBOR_PROP_DELAY_THRESH_NS get more higher value then it works well
I think it's important to enter set_ascapable function

PTP_TRANSPORT_SPECIFIC field maybe zero value at linux ptp for default but in xmos ptp this value should be 1 to process message.
i don't know how to configure linux ptp so i changed xmos source code.

PTP_DEFAULT_DEST_ADDR needs two type of destination address above. LLDP and IEEE something
sync or announce uses LLDP and peer-to peer message use second mac address
you don't need this configuration to communicate between xmos boards. but to process ptp packet at linux pc then you will need this.

so i checked both pps signals
ah one more !
if you trying this between Xmos boards each boards should have unique source mac address

1. my_port_id.data
2. sourceportidentity
3. source_port_id

check this at ptp_init or other function..

now i 'm solving a new problem

xrun: Cannot load image, XCore 0 is not enabled

after uploading at flash memory this phenomenon appears.
do you know how to solve this.

I'm getting crazy
etori90
Member
Posts: 8
Joined: Thu Sep 05, 2019 6:49 am

Postby etori90 » Thu Jul 23, 2020 4:23 am

how I can show you my project? I'm using default configuration at linux ptp not gptp configuration..
etori90
Member
Posts: 8
Joined: Thu Sep 05, 2019 6:49 am

Postby etori90 » Thu Jul 23, 2020 4:24 am

akp wrote:
Wed Jul 22, 2020 5:24 pm
Do you have a project that builds, I might be able to take a look. I have a fair amount of experience with gptp. Just to make sure, you have GPTP running on the linux machine?
how I can show you my project? I'm using default configuration at linux ptp not gptp configuration..
etori90
Member
Posts: 8
Joined: Thu Sep 05, 2019 6:49 am

Postby etori90 » Thu Jul 23, 2020 4:25 am

nick wrote:
Tue Jul 21, 2020 7:47 am
Hi,
I'm interested in this application too.
As I understand there are two functions: ptp_server and gptp_media_clock_server (used by the AVB application note). The latter can be used to tune the master clock on the xmos board.
I tried to use both of them without any success.
Let me know if you did something new.
I didn't use media server only ptp_server and gpio output function

Who is online

Users browsing this forum: No registered users and 2 guests