您尚未登录。

#1 Re: 工业芯 匠芯创 » 213 RT_USING_SAL socket_init 失败 » 2025-02-18 15:50:48

sdk v1.1.2, 使用rtt的lwip 打开sal 相关功能,可以了,但是连接不是很稳定,用空的(刚刚git 下载的新的),无论是使用rtt的lwip 还是aic的third package里面的lwip都是一样的,ping 的时候

[I aicmac_rt_phy_poll_thread()95  Port 0 link UP! autoneg mode: speed 100M, full duplex, flow control on.
[I aicmac_rt_phy_poll_thread()115  Port 0 link DOWN!
[I aicmac_rt_phy_poll_thread()95  Port 0 link UP! autoneg mode: speed 100M, full duplex, flow control on.
[I aicmac_rt_phy_poll_thread()115  Port 0 link DOWN!
[I aicmac_rt_phy_poll_thread()95  Port 0 link UP! autoneg mode: speed 100M, full duplex, flow control on.
[I aicmac_rt_phy_poll_thread()115  Port 0 link DOWN!
[I aicmac_rt_phy_poll_thread()95  Port 0 link UP! autoneg mode: speed 100M, full duplex, flow control on.
[I aicmac_rt_phy_poll_thread()115  Port 0 link DOWN!

来自 10.10.0.34 的回复: 字节=32 时间<1ms TTL=255
来自 10.10.0.34 的回复: 字节=32 时间<1ms TTL=255
来自 10.10.0.34 的回复: 字节=32 时间<1ms TTL=255
来自 10.10.0.34 的回复: 字节=32 时间<1ms TTL=255
请求超时。
请求超时。
请求超时。
来自 10.10.0.33 的回复: 无法访问目标主机。
来自 10.10.0.34 的回复: 字节=32 时间=918ms TTL=255
来自 10.10.0.34 的回复: 字节=32 时间<1ms TTL=255
来自 10.10.0.34 的回复: 字节=32 时间<1ms TTL=255

感觉这个可能跟环境有关,后面会试下电脑直连开发板

#2 Re: 工业芯 匠芯创 » 213 RT_USING_SAL socket_init 失败 » 2025-02-18 09:18:23

发现 sdk v1.1.1 使用 Local packages options → Third-party packages options 里面的
LwIP: light weight TCP/IP stack
能够ping通时 需要选中        LwIP Examples
否则就ping不通了。

发现这个关联到 LPKG_LWIP_EXAMPLES这个宏定义,奇怪的是全局搜索时候

Kconfig (packages\third-party\lwip) line 45 :     config LPKG_LWIP_EXAMPLES
Kconfig (packages\third-party\lwip) line 52 : #    if LPKG_LWIP_EXAMPLES
main in main.c (application\baremetal\helloworld) : #ifdef LPKG_LWIP_EXAMPLES
main in main.c (application\freertos\helloworld) : #ifdef LPKG_LWIP_EXAMPLES
main in main.c (application\ucos-ii\helloworld) : #ifdef LPKG_LWIP_EXAMPLES
rtconfig.h line 710 : #define LPKG_LWIP_EXAMPLES
SConscript (packages\third-party\lwip) line 327 : if GetDepend(['LPKG_LWIP_EXAMPLES']):

并没有在rt-thread的相关代码片段(比如main.c)找到有引用这个LPKG_LWIP_EXAMPLES的开关切换的地方。
他到底是怎么起作用的(打开才能ping通),进一步分析发现是在。

#if defined(KERNEL_RTTHREAD)
#include <rtthread.h>
#include <rtdevice.h>
#include <aic_core.h>

int lwip_test_example_init(void)
{
    aicos_thread_create("lwip_test_example", 4096,
                            20, lwip_test_example_main_loop, NULL);

    return 0;
}

INIT_DEVICE_EXPORT(lwip_test_example_init);
#endif

这里被初始化进系统的(奇怪的是ps命令列出的线程列表里面没有这个name 为 lwip_test_example 的线程,查看代码分析后应该是执行完毕被释放了)。

但是我安照此方法,在v1.1.2 sdk中选中 LwIP Examples 后 ifconfig 可以正常使用,但是没有ping通。

最后又返回认真对照“MAC 应用指南”,发现是没有配

Enable CLK_OUT2
        (25000000) Clk CLK_OUT2 frequence

配完后v1.1.2 在不开启sal时候也是可以ping得通了。

#3 Re: 工业芯 匠芯创 » 213 RT_USING_SAL socket_init 失败 » 2025-02-17 15:07:52

最新的V1.1.2 的SDK,在此环境下,
使用  Rt-Thread options → RT-Thread Components → Network   LwIP: light weight TCP/IP stack
的时候能够编译成功,但是盒v1.1.1的一样网口灯不亮,ping不通。
使用  Local packages options → Third-party packages options 里面的
LwIP: light weight TCP/IP stack
的时候,编译错误,
kernel\rt-thread\components\net\sal\impl\af_inet_lwip.c:168:31: error: 'struct lwip_sock' has no member named 'wait_head'
  168 |         rt_wqueue_wakeup(&sock->wait_head, (void*) event);

kernel\rt-thread\components\net\sal\impl\af_inet_lwip.c:310:5: error: 'lwip_gethostbyname' undeclared here (not in a function); did you mean 'lwip_getsockname'?
  310 |     lwip_gethostbyname,

我打开了rtt 的 sal 功能,因为我要用这个。

sal 相关功能关闭的时候能够编译过去,但是也还没有ping通,网口灯不亮。

#4 Re: 工业芯 匠芯创 » RT-Thread online packages 如何使用? » 2025-02-08 11:10:55

这些 pkgs 命令 是在vscode 的terminal里面输入的,是不是有效地方没配置好?

#5 工业芯 匠芯创 » RT-Thread online packages 如何使用? » 2025-02-08 10:31:18

pineyer
回复: 1

RT-Thread online packages → IoT - internet of things → FreeModbus: Modbus master and slave stack → Slave mode

--- Slave mode
advanced configuration  --->
*   Enable RTU slave mode
[ ]   Enable ASCII slave mode
*  Enable TCP slave mode
[ ]   Use Contorl Pin
*  Enable slave sample
(1)     Slave device address

配置如上,保存后 rtconfig.h文档插入内容如下
。。。


#define PKG_USING_FREEMODBUS
#define PKG_MODBUS_SLAVE



#define RT_S_DISCRETE_INPUT_START 0
#define RT_S_DISCRETE_INPUT_NDISCRETES 16
#define RT_S_COIL_START 0
#define RT_S_COIL_NCOILS 64
#define RT_S_REG_INPUT_START 0
#define RT_S_REG_INPUT_NREGS 100
#define RT_S_REG_HOLDING_START 0
#define RT_S_REG_HOLDING_NREGS 100
#define RT_S_HD_RESERVE 0
#define RT_S_IN_RESERVE 0
#define RT_S_CO_RESERVE 0
#define RT_S_DI_RESERVE 0
#define PKG_MODBUS_SLAVE_RTU
#define PKG_MODBUS_SLAVE_TCP
#define PKG_MODBUS_SLAVE_SAMPLE
#define MB_SAMPLE_SLAVE_ADDR 1
#define MB_SLAVE_USING_PORT_NUM 3
#define MB_SLAVE_USING_PORT_BAUDRATE 115200
#define PKG_USING_FREEMODBUS_LATEST_VERSION

。。。

试过
pkgs --install freemodbus

pkgs --update

pkgs --force-update

好像都没有效果

以前用rt-thread studio 配置好后是自动安装的,不知这个在终端里面是怎么操作的!知道的烦请告诉一声,谢谢!

#6 Re: 工业芯 匠芯创 » me 配置里面选中某个第三方的pkgs后要手动安装安装pkgs? » 2025-02-07 10:49:26

看到/packages/third-party/libmodbus ,已经有这个东西了,日期是之前的,是已经下载好的, 不用下载。

#7 工业芯 匠芯创 » me 配置里面选中某个第三方的pkgs后要手动安装安装pkgs? » 2025-02-07 10:45:49

pineyer
回复: 2

之前用的rt-thread studio 开发环境,配置好后是自动安装的。并且我常用的是那个freemodbus,这个环境里面没有这个选项,倒是有这个libmodbus,选中后注意到有这样一段输出

*** If you want to install rt-thread component online,try 'pkgs'.

然后就试了一下命令

E:\RTTWS\SmartPanelAICD213>pkgs install libmodbus

E:\RTTWS\SmartPanelAICD213>pkgs list --installed

E:\RTTWS\SmartPanelAICD213>

没啥反应

#8 Re: 工业芯 匠芯创 » 奇怪的test_can测试,本地 CAN口只能在收到本地另一can口的一次数据传输后才能正常接收到第三方设备发过来的数据。 » 2025-02-06 17:59:39

发现问题更复杂一点,can盒有两个通道,我把两个通道并在了一起,正常的话一个通道发送数据出去一定会在另外一个通道上收到,发现D213 CAN1 收不到数时候can 盒的另外一个通道也没有收的数,可能是can盒的发送通道出错了。进一步测试发现:
1,单独can盒双通道并一起收发正常,
2,单独213demo can1收,can0发正常。
3,can盒+213 Can1 可以正常收发,can0 如果在线,则必须要打开,否则can盒 tx发不出数据。

这会不会是一个bug,如果总线设备上坏了(比如说cpu坏了),则会造成整个系统不能正常通讯?

#9 工业芯 匠芯创 » 奇怪的test_can测试,本地 CAN口只能在收到本地另一can口的一次数据传输后才能正常接收到第三方设备发过来的数据。 » 2025-02-06 16:42:48

pineyer
回复: 3

硬件版本D213ECV_Demo V4.0,
软件版本V1.1.1,
me 打开 AIC_CAN_DRV_TEST ,编译下载,
aic /> can_rx
The can1 received thread is ready...

can盒(USBCAN FD 珠海创芯)工具发送数据,终端没反应(没收到数据)。
此时如果输入命令
can_tx 1a3#11.22.9a.88.ef.00
则打印出
can1 received msg:
ID: 0x1a3 DATA: 11 22 9a 88 ef 00
同时can盒界面也能收到can0发的数据

aic /> can_tx 1a3#11.22.9a.88.ef.00
can1 received msg:
ID: 0x1a3 DATA: 11 22 9a 88 ef 00

此时如果再用can盒调试工具发数据,can1也能收到数据了

aic /> can1 received msg:
ID: 0xa04a0 DATA: bd be bf c0 c1 c2 c3 c4
can1 received msg:
ID: 0xa04a0 DATA: be bf c0 c1 c2 c3 c4 c5
can1 received msg:
ID: 0xa04a0 DATA: bf c0 c1 c2 c3 c4 c5 c6
can1 received msg:
ID: 0xa0108 DATA: c0 c1 c2 c3 c4 c5 c6 c7

想问一下为什么必须(只能)在Tx(CAN0)打开给RX(CAN1)发送一次数据后,RX(CAN1)才能收到第三方(can盒)发送的数据???之前(仅RX_CAN:CAN1,can盒设备一直在系统)怎么操作(关闭、重新打开can盒软件)都不行。

#10 Re: 工业芯 匠芯创 » 213 RT_USING_SAL socket_init 失败 » 2025-01-24 18:23:06

启用rt-thread 那个lwip 后直接ping不通了

                 pri  status      sp     stack size max used left tick  error
---------------- ---  ------- ---------- ----------  ------  ---------- ---
touch             25  suspend 0x0000029c 0x00001000    26%   0x00000004 OK
tx_serial         25  suspend 0x000002a4 0x00000800    49%   0x00000008 OK
rx_serial         25  suspend 0x00000334 0x00000800    40%   0x0000000a OK
LVGL              20  ready   0x00000250 0x00008000    10%   0xfffffec8 ETIMOUT
tshell            20  running 0x000005a8 0x00001000    35%   0x00000008 OK
usbh_hub0          0  suspend 0x00000360 0x00001000    22%   0x00000009 OK
mmcsd_detect      22  suspend 0x000002e0 0x00002000    37%   0x00000011 OK
alarmsvc          10  suspend 0x00000284 0x00000800    31%   0x00000005 OK
sys workq         23  suspend 0x00000234 0x00000800    27%   0x0000000a OK
tcpip             10  suspend 0x000002f4 0x00000800    36%   0x00000014 OK
etx               12  suspend 0x00000290 0x00000800    32%   0x00000010 OK
erx               12  suspend 0x000002c8 0x00000800    34%   0x00000010 OK
tidle0            31  ready   0x00000248 0x00000400    61%   0x00000018 OK
aic /> ifconfig
ifconfig: network interface device list error.
aic />

#11 Re: 工业芯 匠芯创 » 213 RT_USING_SAL socket_init 失败 » 2025-01-24 17:58:17

static err_t eth_netif_device_init(struct netif *netif) 函数里面会调用 netdev_add(netif);将netif 插入到netdev_list 中,于是在里面插入了一条打印信息
static err_t eth_netif_device_init(struct netif *netif)
{
    struct eth_device *ethif;

    ethif = (struct eth_device*)netif->state;
    LOG_I("eth_netif_device_init:netif=0x%08x", netif);//插入打印信息
    if (ethif != RT_NULL)
    {
        rt_device_t device;

#ifdef RT_USING_NETDEV
        /* network interface device register */
        netdev_add(netif);
#endif /* RT_USING_NETDEV */

程序更新后发现并没有打印出来,说明这个函数没有被调用。

发现这个依赖于RT_USING_LWIP,查找kconfig 发现要选中Rt-Thread options → RT-Thread Components → Network
LwIP: light weight TCP/IP stack  ----     这里的配置。

现在要重新配置了,感觉太乱了,自己非得要再加一个另外的lwip 功能还支持不全!

#12 Re: 工业芯 匠芯创 » 213 RT_USING_SAL socket_init 失败 » 2025-01-23 18:41:14

Rt-Thread options → RT-Thread Components → Network
LwIP: light weight TCP/IP stack  ----     这个是没有选中,
选中的是 Local packages options → Third-party packages options 里面的
LwIP: light weight TCP/IP stack  --->
网络相关配置是参考sdk 文档里面 rtos 相关的配置方式,是可以ping通的

#14 Re: 工业芯 匠芯创 » 213 RT_USING_SAL socket_init 失败 » 2025-01-23 18:20:07

在函数 struct netdev *netdev_get_by_family(int family)中
    if (netdev_list == RT_NULL)
    {
        LOG_E("NULL netdev_list"); // 新增添
        return RT_NULL;
    }

然后
01-01 17:12:03 E/netdev: NULL netdev_list
01-01 17:12:03 E/sal.skt: not find network interface device by protocol family(2).
01-01 17:12:03 E/sal.skt: SAL socket protocol family input failed, return error -3.

网络是正常的,可以ping通。

#15 工业芯 匠芯创 » 213 RT_USING_SAL socket_init 失败 » 2025-01-22 10:35:58

pineyer
回复: 8

应用层代码从RT-thread studio 平台移植过来的,在使用socket 方式,aic 这个平台有点奇怪,又单独弄了个packages\third-party\lwip
这里面没有相关使用sal的配置,跑到原rt-thread components 下 打开     
select RT_USING_POSIX_SOCKET   
    select RT_USING_POSIX_SELECT
    select RT_USING_SAL
    select RT_USING_POSIX_POLL

编译能够通过,有比较多的警告,运行时候错误

01-01 09:34:05 E/sal.skt: not find network interface device by protocol family(2).
01-01 09:34:05 E/sal.skt: SAL socket protocol family input failed, return error -3.
socket() failed: Not supported

#16 Re: 工业芯 匠芯创 » 昆仑派D133CBS更换高分辨率屏 » 2025-01-17 11:42:28

我也碰到触摸的问题了,问题一言难尽!

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn