9G-STM32 LwIP测试过程简介
1,在http://www.st.com/mcu/devicedocs-STM32F107RC-110.html
下载lwIP TCP/IP stack demonstration for STM32F107xx connectivity line microcontrollers软件包
an3102.zip
http://www.st.com/stonline/products/support/micro/files/an3102.zip
2,在http://www.st.com/mcu/devicedocs-STM32F107RC-110.html
下载lwIP TCP/IP stack demonstration for STM32F107xx connectivity line microcontrollers文档
16620.pdf
http://www.st.com/stonline/products/literature/an/16620.pdf
3,有关STM32F107VC-PKT的PCB和SCH和测试代码见下面连接:STM32F107VC_SCH.pdf
STM32F107VC_PCB.pdfSTM32107_LK_SelfTest.zip
二,建立STM32 LwIP开发工程
1,把an3102.zip解压到D:works形成工程文件夹:D:worksSTM32F107_ETH_LwIP_V1.0.0 ;
2,进入到目录D:worksSTM32F107_ETH_LwIP_V1.0.0ProjectEWARMv5,双击Project.eww打开工程;
3,在EWARM中的Project->make 编译通过整个项目。
三,修改STM32 LwIP开发工程
1,打开Project->Options ,在Category中选择Debugger的setup驱动用J-Link/J-Trace,在J-Link/J-Trace
中选择connection的SWD接口;
2,对STM32F107VC-PKT开发板加上5V的直流电源,把J-LINK用USB线连接到PC的USB口上,执行Project->Download and Debug
下载代码到板子后,执行Debug->Go 。
四,修改STM32 LwIP开发源码
1,在D:worksSTM32F107_ETH_LwIP_V1.0.0Projectsrcmain.c 的53行后添加如下代码:
/* Output a message on Hyperterminal using printf function */
printf("");
printf("*** STM32F107VC-PKT V1.0 Build byyuanxihua@21cn.comon ("__DATE__ " - " __TIME__ ")");
printf("*** STM32F107VC-PKT V1.0 Rebooting ...");
2,在D:worksSTM32F107_ETH_LwIP_V1.0.0Projectsrcstm32f107.c 的包含头文件中添加:
#include "stdio.h"
在第30行选择用MII模式:
#define MII_MODE /* MII mode for STM3210C-EVAL Board (MB784) (check jumpers setting) */
//#define RMII_MODE /* RMII mode for STM3210C-EVAL Board (MB784) (check jumpers setting) */
在54行后添加:
USART_InitTypeDef USART_InitStructure;
在125行后添加:
/* Configure the com port */
/* USARTx configuration ------------------------------------------------------*/
/* USARTx configured as follow:
- BaudRate = 115200 baud
- Word Length = 8 Bits
- One Stop Bit
- No parity
- Hardware flow control disabled (RTS and CTS signals)
- Receive and transmit enabled
*/
USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No ;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
STM_EVAL_COMInit(COM1, &USART_InitStructure);
}
/**
* @brief Retargets the C library printf function to the USART.
* @param None
* @retval : None
*/
int fputc(int ch, FILE *f)
{
/* Write a character to the USART */
USART_SendData(USART2, (uint8_t) ch);
/* Loop until the end of transmission */
while(USART_GetFlagStatus(USART2, USART_FLAG_TXE) == RESET)
{
}
return ch;
}
/**
* @brief Get a key from the HyperTerminal
* @param None
* @retval : The Key Pressed
*/
int fgetc(FILE *f)
{
/* Waiting for user input */
while ( USART_GetFlagStatus(USART2, USART_FLAG_RXNE) == RESET);
return (uint8_t)USART2->DR;
在341-344行修改为:
/* ADC Channel10 config --------------------------------------------------------*/
/* Relative to STM32F107VC-PKT Board */
/* Configure PC.00 (ADC Channel10) as analog input -------------------------*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
在375-376行修改为:
/* ADC1 regular channel10 configuration */
ADC_RegularChannelConfig(ADC1, ADC_Channel_10, 1, ADC_SampleTime_13Cycles5);
3,在D:worksSTM32F107_ETH_LwIP_V1.0.0Projectsrcetconf.c 中的119-121行和316-318行把
IP地址都修改如下:
IP4_ADDR(&ipaddr, 192, 168, 1, 8);
IP4_ADDR(&netmask, 255, 255, 255, 0);
IP4_ADDR(&gw, 192, 168, 1, 1);
STM32LwIP测试过 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)