isme
isme - 认证专家
冰镇大西瓜

注册于 2 年前

回答
280
文章
17
关注者
23

wifi 模块端无法获取同一局域网中其他设备的 ip 地址和端口号呀.

进入透传模式后, 发送 +++ 三个字符退出透传模式, 发送时不能勾选换行符.

W806 SDK 用的就是模拟 I2C 可以参考.

/***************************************************************************** 
* 
* File Name :  main. c
* 
* Description:  main 
* 
* Copyright  (c)  2014 Winner Micro Electronic Design Co. ,  Ltd.  
* All rights reserved.  
* 
* Author :  dave
* 
* Date :  2014-6-14
*****************************************************************************/ 
#include "wm_include. h"

static OS_STK TaskStk1[512]; 
static OS_STK TaskStk2[512]; 

static void user_task1 (void) 
{

    while (1) 
    {
        printf ("---  %s\r\n", __func__) ; 
        tls_os_time_delay (HZ) ; 
    }
}

static void user_task2 (void) 
{

    while (1) 
    {
        printf ("---  %s\r\n", __func__) ; 
        tls_os_time_delay (HZ) ; 
    }
}

void UserMain (void) 
{
    printf ("\n user task \n") ; 
    tls_os_task_create (NULL,  "task1", 
                         ( void  (*) ) user_task1, 
                        NULL, 
                         (void *) TaskStk1,           /* task's stack start address */
                        sizeof (TaskStk1) ,  /* task's stack size,  unit: byte */
                        31, 
                        0) ; 
    tls_os_task_create (NULL,  "task2", 
                         ( void  (*) ) user_task2, 
                        NULL, 
                         (void *) TaskStk2,           /* task's stack start address */
                        sizeof (TaskStk2) ,  /* task's stack size,  unit: byte */
                        32, 
                        0) ; 

#if DEMO_CONSOLE
    CreateDemoTask () ; 
#endif
//用户自己的 task
}

image. png

应该是通讯时序问题, 可以用逻辑分析仪看下波形.
i2c 通讯可以参考这个http: //ask. winnermicro. com/question/58. html

淘宝官方店铺有售
[W80X/W60X 离线烧录板卡]
image. png

W801 确实没有 wakeup 脚, 没办法 gpio 唤醒, 只能定时器唤醒, 可以尝试定时器间歇性唤醒查询 gpio 口的引脚状态, 来降低功耗.

printf (" ---  GetHeap: %d\n", tls_mem_get_avail_heapsize () ) ; 

检查下你新建的任务有没有加延时函数

while (1) 
{
    tls_os_time_delay (HZ/1000) 
}

建议用法

// 可以在网络状态回调函数中发送信号量
static void con_net_status_changed_event (u8 status ) 
{
    switch (status) 
    {
    case NETIF_WIFI_JOIN_SUCCESS: 
        printf ("--- NETIF_WIFI_JOIN_SUCCESS\n") ; 
        break; 
    case NETIF_WIFI_JOIN_FAILED: 
        printf ("--- NETIF_WIFI_JOIN_FAILED\n") ; 
        light_off (&led0) ; 
        break; 
    case NETIF_WIFI_DISCONNECTED: 
        printf ("--- NETIF_WIFI_DISCONNECTED\n") ; 
        break; 
    case NETIF_IP_NET_UP: 
    {
        struct tls_ethif *tmpethif = tls_netif_get_ethif () ; 
        print_ipaddr (&tmpethif- ip_addr) ; 
#if TLS_CONFIG_IPV6
        print_ipaddr (&tmpethif- ip6_addr[0]) ; 
        print_ipaddr (&tmpethif- ip6_addr[1]) ; 
        print_ipaddr (&tmpethif- ip6_addr[2]) ; 
#endif
    }
    break; 
    default: 
        //printf ("UNKONWN STATE: %d\n",  status) ; 
        break; 
    }
}

void UserMain (void) 
{
    printf ("\n user task \n") ; 
    u8 auto_reconnect = 0xff; 
    tls_wifi_auto_connect_flag (WIFI_AUTO_CNT_FLAG_GET,  &auto_reconnect) ; 
    if (auto_reconnect ! = WIFI_AUTO_CNT_ON) 
    {
        auto_reconnect = WIFI_AUTO_CNT_ON; 
        tls_wifi_auto_connect_flag (WIFI_AUTO_CNT_FLAG_SET,  &auto_reconnect) ;  
        tls_wifi_connect ( (u8 *) "w600",  strlen ("w600") ,   (u8 *) "12345678",  strlen ("12345678") ) ; 
        printf ("--- WIFI_AUTO_CNT_FLAG_SET ON\n") ; 
    }
    // 注册网络状态回调
    tls_netif_add_status_event (con_net_status_changed_event) ; 

#if DEMO_CONSOLE
    CreateDemoTask () ; 
#endif
//用户自己的 task
}

发布
问题