USR-WIFI232-B2调试经历

来源:互联网 发布:hadoop hdfs 端口号 编辑:程序博客网 时间:2024/04/29 09:01

本来7寸人机交互设备好好的,客户提出需要加手机控制,那就搞啦。

选了一个带AP的WIFI模块USR-WIFI232-B2。

拿到手就一个裸板子,看说明还需要把nReload上拉,于是手工焊了个4.7K电阻到3.3V。

剩下的就是连线啦,如下图所示:



MCU用的是STM32F103V

代码配置如下:

#define WIFI_RESET_PINGPIO_Pin_6#define WIFI_RESET_PORTGPIOC#define WIFI_NREADY_PINGPIO_Pin_8#define WIFI_NREADY_PORTGPIOC#define WIFI_NLINK_PINGPIO_Pin_7#define WIFI_NLINK_PORTGPIOC#define WIFI_NRELOAD_PINGPIO_Pin_9#define WIFI_NRELOAD_PORTGPIOC

void WiFi_GPIO_Init(void){GPIO_InitTypeDef GPIO_InitStructure;GPIO_InitStructure.GPIO_Pin = WIFI_RESET_PIN;   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;  GPIO_Init(WIFI_RESET_PORT, &GPIO_InitStructure);GPIO_ResetBits(WIFI_RESET_PORT, WIFI_RESET_PIN);GPIO_InitStructure.GPIO_Pin = WIFI_NRELOAD_PIN;   GPIO_Init(WIFI_NRELOAD_PORT, &GPIO_InitStructure);GPIO_SetBits(WIFI_NRELOAD_PORT, WIFI_NRELOAD_PIN);  GPIO_InitStructure.GPIO_Pin = WIFI_NLINK_PIN;   GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_IN_FLOATING;  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;  GPIO_Init(WIFI_NLINK_PORT, &GPIO_InitStructure);  GPIO_InitStructure.GPIO_Pin = WIFI_NREADY_PIN;   GPIO_Init(WIFI_NREADY_PORT, &GPIO_InitStructure);  }
void WiFi_Reset(void){GPIO_ResetBits(WIFI_RESET_PORT, WIFI_RESET_PIN);Delay_1ms(350);GPIO_SetBits(WIFI_RESET_PORT, WIFI_RESET_PIN);}

void Task_200ms(void){printf("\r\n nReady %d", GPIO_ReadInputDataBit(WIFI_NREADY_PORT,WIFI_NREADY_PIN));printf(" nLink %d", GPIO_ReadInputDataBit(WIFI_NLINK_PORT,WIFI_NLINK_PIN));printf(" nRelaod %d", GPIO_ReadInputDataBit(WIFI_NRELOAD_PORT,WIFI_NRELOAD_PIN));printf(" RESET %d", GPIO_ReadInputDataBit(WIFI_RESET_PORT,WIFI_RESET_PIN));}

系统启动,MCU DEBUG信息: 

nReady 0 nLink 1 nRelaod 1 RESET 1

OK,连接WIFI

 nReady 0 nLink 0 nRelaod 1 RESET 1

连接OK

开始测试:


四步走,搞定。

记得以前自己搞过一个安卓Socket通信应用,于是把他找出来


开始运行:


萌萌的。

点击Connect,输入字符,Send


接收OK。

等等,官方还提供了IOS程序,测试下:





搞定……

测试结束,下面开始应用啦!




0 0
原创粉丝点击