方案目的:mcu通过串口和gprs 模块连接,gprs模块将串口数据转到设置好的服务器。
方案成本:100rmb内(模块75rmb零售价,天线,pcb板等自行计算)
方案特色:低成本,soc化,soc内部可以编程!有服务器中间件提供的ack机制保证稳定性,快速的短线重连接。
支持:md251的供应商提供一般技术支持。
硬件稳定性:因为md251就是mtk的手机板,稳定性由广大山塞手机用户可以验证。
方案主芯片:MT6252A MTK
芯片英文介绍:
MT6252 - Single-Chip GSM/GPRS/EGPRS entry-multimedia solution
MT6252 is a single-chip GSM/GPRS/EGPRS solution that offers highest level of integration with lowest power consumption and best-in-class features. Key features include embedded 32MB pseudo-SRAM, external SPI serial flash, multimedia support up to 0.3Mpixel camera, MP4 CIF video and WQVGA display. Integrated RF solution offers exceptional radio performance under stringent ambient conditions. MT6252 platform is pre-integrated with MediaTek's highly proven, feature-rich SW solution thus considerably reducing the design cycle time and increasing the phone premium for consumers.
Features
● GSM/GPRS Class 12, Quad band
● ARM7-EJ 104MHz
● Embedded 32MB pseudo-SRAM
● Audio: MP3, AAC, AMR-NarrowBand
● Tier-1 voice noise reduction and echo cancellation
● Support up to 262K color WQVGA LCM
● Support up to 0.3MP camera (YUV)
● MP4 CIF@30fps video decode and up to HVGA@15fps.
● Rich video codec support: H.264, AVI, MJPEG
● Support dual-standby single talk
● Integrated RF, PMU, USB 2.0 FS
● Integrated Class-AB audio amplifier (700mW@3.7V)
● Integrated resistive touch controller
● Pre-integrated with MediaTek’s highly proven, feature-rich SW platform.
oa_uart_set_read_delay(OA_UART2, 48); //set the time interval between uart data, for received data frame by frame,one frame max length is 300 bytes
看英文注释哈。
oa_uart_register_callback(OA_UART2, uart_null); //register UART1 received data callback function
这个是操作系统的特点了,回调函数的,这里指向一个直接return的函数uart_null因为,开始没有加入网络期间,这段时间gprs数据是无法收发的,所以直接扔掉,但是又不能让串口的数据对系统构成影响,所以直接写了个null函数,就是gprs不通的时候,数据全部扔掉(什么?缓存所有的?也可以,但是大部分系统都是侧重于实时数据吧,比如说一个电机,gprs恢复了你也是首先关注当前信息吧!所以系统设计的第一要求是尽量的上传实时数据!)
oa_timer_start(OA_APP_SCHEDULER_ID, wait_gsm, NULL, 1000);
这个类似于for(;;), while(1)之类,1000表示1s执行一次,执行的函数名叫wait_gsm。看名就知道这个是等待gsm网络ready的。就是你手机打开以后会等一回才能加入网络,一般刚开机,会经过10s左右。我测试是15s左右。
}作者: sinanjj 时间: 2012-6-8 10:17 本帖最后由 sinanjj 于 2012-6-8 10:24 编辑
oa_uart_set_read_delay(OA_UART2, 48); //set the time interval between uart data, for received data frame by frame,one frame max length is 300 bytes
oa_memset(ack_seq, '\x01', 256);ack_seq是一个数组,为什么用数组呢?因为数据包的延时ack机制,就是每一个发出的数据包都有一个序列号,这个序列号是1个byte的,作用就是区分ack,相当于tcp里的序列号,每个ack到达与否对应于这个数组中的值。(确实比较难解释。。。)
oa_uart_register_callback(OA_UART2, uart_handler); //register UART1 received data callback function
oa_uart_write (OA_UART2,"\r\nstart\r\n",9); 标识gprs开始