RE: RTEMS 5.3 libbsd, networking issue for 100mbps link (1Gbps is fine)

2023-07-19 Thread Karol Gliwa
Hi Again,

After some research, I found the solution working for PYNQ-Z1 board. Following 
patch does it in my case:

diff --git a/freebsd/sys/arm/xilinx/zy7_slcr.c 
b/freebsd/sys/arm/xilinx/zy7_slcr.c
index 79fccee5..346cfcb7 100644
--- a/freebsd/sys/arm/xilinx/zy7_slcr.c
+++ b/freebsd/sys/arm/xilinx/zy7_slcr.c
@@ -87,7 +87,8 @@ extern void (*zynq7_cpu_reset);
 #define RD4(sc, off)   (bus_read_4((sc)->mem_res, (off)))
 #define WR4(sc, off, val)  (bus_write_4((sc)->mem_res, (off), (val)))
 
-#define ZYNQ_DEFAULT_PS_CLK_FREQUENCY  /* 33.3 Mhz */
+//#define ZYNQ_DEFAULT_PS_CLK_FREQUENCY/* 33.3 Mhz */
+#define ZYNQ_DEFAULT_PS_CLK_FREQUENCY  5000/* 50.0 Mhz */
 
 SYSCTL_NODE(_hw, OID_AUTO, zynq, CTLFLAG_RD, 0, "Xilinx Zynq-7000");


With this patch applied I'm not getting the warning and I'm able to communicate 
with 100mbps link now. I'll try same method with the other device I have 
similar issue.

Kind regards
Karol 

-Original Message-
From: Karol Gliwa 
Sent: Wednesday, July 19, 2023 12:16 PM
To: Chris Johns ; users@rtems.org
Subject: RE: RTEMS 5.3 libbsd, networking issue for 100mbps link (1Gbps is fine)

Hi Chris,

Thanks for this quick clue. I actually managed to run the rtems-libbsd on 
another device that is Picozed+fmc_carrier_board which I believe is very close 
in the HW configuration to the zynq_zedboard.. and my problem does not happen 
anymore with that board. I have successful PING+socket communication with 
100Mbps dongle as well as with 1Gbps link.  What I also noticed is I don’t get 
following messages anymore:  "cgem0: cgem_mediachange: could not set ref clk0 
to 2500." which I've kept ignoring until now.

But regarding the other boards I have problem with. I struggle now with where 
to put the correct configuration. Should that be enough to provide correct 
parms during BSP configure/build or some sources need to be modified? 

I tried to play around with the BSP build config but with no success. I paste 
the BSP build configuration for PYNQ-Z1 board which I currently use:

"""
RUN cd build-bsp-xilinx_zynq_zedboard && PATH="/rtems/5/bin:$PATH"  
../rtems/configure  \
--target=arm-rtems5 \
--enable-tests \ 
--enable-rtemsbsp=xilinx_zynq_zedboard \ 
--disable-networking \   
--enable-posix \  
--enable-smp \   
--prefix=/rtems/5 \  
--enable-maintainer-mode \   
--disable-rtems-debug \  
BSP_ARM_A9MPCORE_PERIPHCLK=65000U \
BSP_CONSOLE_MINOR=0 \
ZYNQ_CLOCK_CPU_1X=10833U \
ZYNQ_CLOCK_UART=1
"""


Thanks for all Help!
Karol Gliwa


-Original Message-
From: Chris Johns 
Sent: Wednesday, July 19, 2023 6:20 AM
To: Karol Gliwa ; users@rtems.org
Subject: Re: RTEMS 5.3 libbsd, networking issue for 100mbps link (1Gbps is fine)

On 18/7/2023 8:21 pm, Karol Gliwa wrote:
> Hi Guys,
>
>
>
> I have following problem with networking on Zynq running RTEMS 5.3 + 
> libbsd + BSP zynq_zedboard of according version.
>
> I had to patch the libbsd to support some network PHY for the boards I use.
>
>
>
> Whenever I connect the device to 1Gbit interface, and the link is 
> negotiated to 1Gbit everything seems working just fine. I can PING the 
> board and successfully connect to TCP/IP socket (custom test echo 
> server basing on the examples int the rtems-libbsd repository + sockets).
>
>
>
> When I connect the board to 100Mbit interface (another usb dongle) it 
> seems to establish the link fine, but I cannot ping the board nor connect to 
> the socket.
> I replicated this behavior with at least three different 1Gbit 
> interfaces (works each time) and two 100Mbit dongles (not working). I 
> confirmed that behavior using PYNQ Z1 board and also with our other custom 
> device.
>
>
>
> Additionally, I had an opportunity to test our custom board with 
> another 'hello world' echo server that came from my colleges that use 
> Xilin'x Vitis + LwIP (bare metal application) and that one has been 
> working in every link speed configuration.
>
>
>
> It seems to me that the problem my reside in the RTEMS software part 
> or drivers (or my compilation or configuration) and not in the HW 
> since I could confirm it's working with LwIP for all configs...
> Unfortunately, I have little experience with networking in general and 
> was not able to solve that issue on my own.
>
>
>
> I attach the RTEMS shell output of `ifconfig -a` executed on PYNQ Z1 
> when connected to 1Gbit eth device (PING working):
>
>
>
> '''
>
> SHLL [/] # ifconfig  cgem0 192.168.10.207 netmask 255.255.255.0
>
> SHLL [/] # ifconfig -a
>
> cgem0: flags=8843 metric 0 mtu
> 

RE: RTEMS 5.3 libbsd, networking issue for 100mbps link (1Gbps is fine)

2023-07-19 Thread Karol Gliwa
Hi Chris,

Thanks for this quick clue. I actually managed to run the rtems-libbsd on 
another device that is Picozed+fmc_carrier_board which I believe is very close 
in the HW configuration to the zynq_zedboard.. and my problem does not happen 
anymore with that board. I have successful PING+socket communication with 
100Mbps dongle as well as with 1Gbps link.  What I also noticed is I don’t get 
following messages anymore:  "cgem0: cgem_mediachange: could not set ref clk0 
to 2500." which I've kept ignoring until now.

But regarding the other boards I have problem with. I struggle now with where 
to put the correct configuration. Should that be enough to provide correct 
parms during BSP configure/build or some sources need to be modified? 

I tried to play around with the BSP build config but with no success. I paste 
the BSP build configuration for PYNQ-Z1 board which I currently use:

"""
RUN cd build-bsp-xilinx_zynq_zedboard && PATH="/rtems/5/bin:$PATH"  
../rtems/configure  \
--target=arm-rtems5 \
--enable-tests \ 
--enable-rtemsbsp=xilinx_zynq_zedboard \ 
--disable-networking \   
--enable-posix \  
--enable-smp \   
--prefix=/rtems/5 \  
--enable-maintainer-mode \   
--disable-rtems-debug \  
BSP_ARM_A9MPCORE_PERIPHCLK=65000U \
BSP_CONSOLE_MINOR=0 \
ZYNQ_CLOCK_CPU_1X=10833U \
ZYNQ_CLOCK_UART=1
"""


Thanks for all Help!
Karol Gliwa


-Original Message-
From: Chris Johns  
Sent: Wednesday, July 19, 2023 6:20 AM
To: Karol Gliwa ; users@rtems.org
Subject: Re: RTEMS 5.3 libbsd, networking issue for 100mbps link (1Gbps is fine)

On 18/7/2023 8:21 pm, Karol Gliwa wrote:
> Hi Guys,
>
>
>
> I have following problem with networking on Zynq running RTEMS 5.3 + 
> libbsd + BSP zynq_zedboard of according version.
>
> I had to patch the libbsd to support some network PHY for the boards I use.
>
>
>
> Whenever I connect the device to 1Gbit interface, and the link is 
> negotiated to 1Gbit everything seems working just fine. I can PING the 
> board and successfully connect to TCP/IP socket (custom test echo 
> server basing on the examples int the rtems-libbsd repository + sockets).
>
>
>
> When I connect the board to 100Mbit interface (another usb dongle) it 
> seems to establish the link fine, but I cannot ping the board nor connect to 
> the socket.
> I replicated this behavior with at least three different 1Gbit 
> interfaces (works each time) and two 100Mbit dongles (not working). I 
> confirmed that behavior using PYNQ Z1 board and also with our other custom 
> device.
>
>
>
> Additionally, I had an opportunity to test our custom board with 
> another 'hello world' echo server that came from my colleges that use 
> Xilin'x Vitis + LwIP (bare metal application) and that one has been 
> working in every link speed configuration.
>
>
>
> It seems to me that the problem my reside in the RTEMS software part 
> or drivers (or my compilation or configuration) and not in the HW 
> since I could confirm it's working with LwIP for all configs... 
> Unfortunately, I have little experience with networking in general and 
> was not able to solve that issue on my own.
>
>
>
> I attach the RTEMS shell output of `ifconfig -a` executed on PYNQ Z1 
> when connected to 1Gbit eth device (PING working):
>
>
>
> '''
>
> SHLL [/] # ifconfig  cgem0 192.168.10.207 netmask 255.255.255.0
>
> SHLL [/] # ifconfig -a
>
> cgem0: flags=8843 metric 0 mtu 
> 1500
>
> options=80008
>
> ether 0e:b0:ba:5e:ba:11
>
> inet6 fe80::cb0:baff:fe5e:ba11%cgem0 prefixlen 64 scopeid 0x1
>
> inet 192.168.10.207 netmask 0xff00 broadcast 
> 192.168.10.255
>
> nd6 options=21
>
> media: Ethernet autoselect (1000baseT )
>
> status: active
>
> lo0: flags=8049 metric 0 mtu 16384
>
> 
> options=680003
>
> inet 127.0.0.1 netmask 0xff00
>
> inet6 ::1 prefixlen 128
>
> inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
>
> nd6 options=21
>
> groups: lo
>
> '''
>
>
>
>
>
> Then hot switch to 100Mbit usb eth card (PING not working):
>
> '''
>
> SHLL [/] # info: cgem0: link state changed to DOWN
>
> cgem0: cgem_mediachange: could not set ref clk0 to 2500.
>
> info: cgem0: link state changed to UP
>
> SHLL [/] # ifconfig  cgem0 172.19.1.207 netmask 255.255.255.0
>
> SHLL [/] # ifconfig -a
>
> cgem0: flags=8843 metric 0 mtu 
> 1500
>
> options=80008
>
> ether 0e:b0:ba:5e:ba:11
>

Re: RTEMS 5.3 libbsd, networking issue for 100mbps link (1Gbps is fine)

2023-07-18 Thread Chris Johns
On 18/7/2023 8:21 pm, Karol Gliwa wrote:
> Hi Guys,
> 
>  
> 
> I have following problem with networking on Zynq running RTEMS 5.3 + libbsd +
> BSP zynq_zedboard of according version.
> 
> I had to patch the libbsd to support some network PHY for the boards I use.
> 
>  
> 
> Whenever I connect the device to 1Gbit interface, and the link is negotiated 
> to
> 1Gbit everything seems working just fine. I can PING the board and 
> successfully
> connect to TCP/IP socket (custom test echo server basing on the examples int 
> the
> rtems-libbsd repository + sockets).
> 
>  
> 
> When I connect the board to 100Mbit interface (another usb dongle) it seems to
> establish the link fine, but I cannot ping the board nor connect to the 
> socket.
> I replicated this behavior with at least three different 1Gbit interfaces 
> (works
> each time) and two 100Mbit dongles (not working). I confirmed that behavior
> using PYNQ Z1 board and also with our other custom device.
> 
>  
> 
> Additionally, I had an opportunity to test our custom board with another 
> 'hello
> world' echo server that came from my colleges that use Xilin'x Vitis + LwIP
> (bare metal application) and that one has been working in every link speed
> configuration.
> 
>  
> 
> It seems to me that the problem my reside in the RTEMS software part or 
> drivers
> (or my compilation or configuration) and not in the HW since I could confirm
> it's working with LwIP for all configs... Unfortunately, I have little
> experience with networking in general and was not able to solve that issue on 
> my
> own.
> 
>  
> 
> I attach the RTEMS shell output of `ifconfig -a` executed on PYNQ Z1 when
> connected to 1Gbit eth device (PING working):
> 
>  
> 
> '''
> 
> SHLL [/] # ifconfig  cgem0 192.168.10.207 netmask 255.255.255.0
> 
> SHLL [/] # ifconfig -a   
> 
> cgem0: flags=8843 metric 0 mtu 1500
> 
>     options=80008
> 
>     ether 0e:b0:ba:5e:ba:11
> 
>     inet6 fe80::cb0:baff:fe5e:ba11%cgem0 prefixlen 64 scopeid 0x1
> 
>     inet 192.168.10.207 netmask 0xff00 broadcast 192.168.10.255
> 
>     nd6 options=21
> 
>     media: Ethernet autoselect (1000baseT )
> 
>     status: active
> 
> lo0: flags=8049 metric 0 mtu 16384
> 
>     options=680003
> 
>     inet 127.0.0.1 netmask 0xff00
> 
>     inet6 ::1 prefixlen 128
> 
>     inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
> 
>     nd6 options=21
> 
>     groups: lo
> 
> '''
> 
>  
> 
>  
> 
> Then hot switch to 100Mbit usb eth card (PING not working):
> 
> '''
> 
> SHLL [/] # info: cgem0: link state changed to DOWN
> 
> cgem0: cgem_mediachange: could not set ref clk0 to 2500.
> 
> info: cgem0: link state changed to UP
> 
> SHLL [/] # ifconfig  cgem0 172.19.1.207 netmask 255.255.255.0 
> 
> SHLL [/] # ifconfig -a 
> 
> cgem0: flags=8843 metric 0 mtu 1500
> 
>     options=80008
> 
>     ether 0e:b0:ba:5e:ba:11
> 
>     inet6 fe80::cb0:baff:fe5e:ba11%cgem0 prefixlen 64 scopeid 0x1
> 
>     inet 172.19.1.207 netmask 0xff00 broadcast 172.19.1.255
> 
>     nd6 options=21
> 
>     media: Ethernet autoselect (100baseTX )
> 
>     status: active
> 
> lo0: flags=8049 metric 0 mtu 16384
> 
>     options=680003
> 
>     inet 127.0.0.1 netmask 0xff00
> 
>     inet6 ::1 prefixlen 128
> 
>     inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
> 
>     nd6 options=21
> 
>     groups: lo
> 
> '''
> 
>  
> 
>  
> 
>  
> 
> Do You have any idea of what may be causing the issue here? Thanks for all 
> help
> in advance.

Are the clocks to the PHY being correctly set and the driver knows the 
frequency.

Chris
___
users mailing list
users@rtems.org
http://lists.rtems.org/mailman/listinfo/users