TI中文支持网
TI专业的中文技术问题搜集分享网站

关于无线模块和单片机的关系

最近在做一个医疗产品的电路板,有一个无线模块和一个Avr单片机,过程是先烧录无线模块,再烧录单片机,单片机先烧熔丝,然后再烧flash,有时候搜不到信号(WiFi),重新烧写一下单片机就好了,我想知道,单片机到底控制了无线模块的什么呢?因为程序是别人写的,所以不太明白。

Alvin Chen:

建议联系你的那个模块的厂家吧,这个不好推测,看起来应该操作的是AP mode。

//****************************************************************************
//
//!\brief start simplelink, wait for the sta to connect to the device and//!run the ping test for that sta
//!
//!\parampvparameters is the pointer to the list of parameters that can be
//!passed to the task while creating it
//!
//!\return None
//
//****************************************************************************
void WlanAPMode( void *pvParameters )
{int iTestResult = 0;unsigned char ucDHCP;long lRetVal = -1;InitializeAppVariables();//// Following function configure the device to default state by cleaning// the persistent settings stored in NVMEM (viz. connection profiles &// policies, power policy etc)//// Applications may choose to skip this step if the developer is sure// that the device is in its default state at start of applicaton//// Note that all profiles and persistent settings that were done on the// device will be lost//lRetVal = ConfigureSimpleLinkToDefaultState();if(lRetVal < 0){if (DEVICE_NOT_IN_STATION_MODE == lRetVal)UART_PRINT("Failed to configure the device in its default state \n\r");LOOP_FOREVER();}UART_PRINT("Device is configured in default state \n\r");//// Asumption is that the device is configured in station mode already// and it is in its default state//lRetVal = sl_Start(NULL,NULL,NULL);if (lRetVal < 0){UART_PRINT("Failed to start the device \n\r");LOOP_FOREVER();}UART_PRINT("Device started as STATION \n\r");//// Configure the networking mode and ssid name(for AP mode)//if(lRetVal != ROLE_AP){if(ConfigureMode(lRetVal) != ROLE_AP){UART_PRINT("Unable to set AP mode, exiting Application...\n\r");sl_Stop(SL_STOP_TIMEOUT);LOOP_FOREVER();}}while(!IS_IP_ACQUIRED(g_ulStatus)){//looping till ip is acquired}unsigned char len = sizeof(SlNetCfgIpV4Args_t);SlNetCfgIpV4Args_t ipV4 = {0};// get network configurationlRetVal = sl_NetCfgGet(SL_IPV4_AP_P2P_GO_GET_INFO,&ucDHCP,&len,(unsigned char *)&ipV4);if (lRetVal < 0){UART_PRINT("Failed to get network configuration \n\r");LOOP_FOREVER();}UART_PRINT("Connect a client to Device\n\r");while(!IS_IP_LEASED(g_ulStatus)){//wating for the client to connect}UART_PRINT("Client is connected to Device\n\r");iTestResult = PingTest(g_ulStaIp);if(iTestResult < 0){UART_PRINT("Ping to client failed \n\r");}UNUSED(ucDHCP);UNUSED(iTestResult);// revert to STA modelRetVal = sl_WlanSetMode(ROLE_STA);if(lRetVal < 0){ERR_PRINT(lRetVal);LOOP_FOREVER();}// Switch off Network processorlRetVal = sl_Stop(SL_STOP_TIMEOUT);UART_PRINT("WLAN AP example executed successfully");while(1);
}

gaoyang9992006:

很多年前学单片机时候用过AVR,好像是烧录完flash后,可以烧断熔丝,保护内部的代码。单片机是通过通信接口比如串口或者SPI,IIC等这些接口跟无线模块通信,无线模块充当了一个传话人的角色。

赞(0)
未经允许不得转载:TI中文支持网 » 关于无线模块和单片机的关系
分享到: 更多 (0)