add eth --//242.16 KB /51556-64564-70868 add ETH
无ifconfig 无ping
This commit is contained in:
parent
5284e1c741
commit
a7102ab2dc
@ -15,11 +15,13 @@
|
||||
#include <ulog.h>
|
||||
#include <board.h>
|
||||
|
||||
#define LED_HEART GET_PIN(E,3)
|
||||
#define ETH_RESET_PIN GET_PIN(E, 7)//71
|
||||
//#define RESET_LB GET_PIN(E, 1)
|
||||
//#define RESET_UB GET_PIN(E, 0)
|
||||
//#define RESET_CE GET_PIN(G, 10)
|
||||
//#define LED_HEART GET_PIN(E,3)
|
||||
//#ifndef ETH_RESET_PIN
|
||||
//#define ETH_RESET_PIN GET_PIN(E, 7)//71
|
||||
//#endif
|
||||
////#define RESET_LB GET_PIN(E, 1)
|
||||
////#define RESET_UB GET_PIN(E, 0)
|
||||
////#define RESET_CE GET_PIN(G, 10)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
@ -98,4 +98,79 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
|
||||
}
|
||||
|
||||
}
|
||||
//185.47kB/103180B no ETH
|
||||
/**
|
||||
* @brief ETH MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param heth: ETH handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
if(heth->Instance==ETH)
|
||||
{
|
||||
/* USER CODE BEGIN ETH_MspInit 0 */
|
||||
|
||||
/* USER CODE END ETH_MspInit 0 */
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_ETH_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
/**ETH GPIO Configuration
|
||||
PC1 ------> ETH_MDC
|
||||
PA1 ------> ETH_REF_CLK
|
||||
PA2 ------> ETH_MDIO
|
||||
PA7 ------> ETH_CRS_DV
|
||||
PC4 ------> ETH_RXD0
|
||||
PC5 ------> ETH_RXD1
|
||||
PG11 PB11 ------> ETH_TX_EN
|
||||
PG13 PB12 ------> ETH_TXD0
|
||||
PG14 PB13 ------> ETH_TXD1
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_7;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_14|GPIO_PIN_13;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
|
||||
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
|
||||
|
||||
/* ETH interrupt Init */
|
||||
HAL_NVIC_SetPriority(ETH_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(ETH_IRQn);
|
||||
/* USER CODE BEGIN ETH_MspInit 1 */
|
||||
|
||||
/* USER CODE END ETH_MspInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void phy_reset(void)
|
||||
{
|
||||
rt_pin_mode(ETH_RESET_PIN, PIN_MODE_OUTPUT);
|
||||
rt_pin_write(ETH_RESET_PIN, PIN_HIGH);
|
||||
rt_thread_mdelay(50);
|
||||
rt_pin_write(ETH_RESET_PIN, PIN_LOW);
|
||||
rt_thread_mdelay(50);
|
||||
rt_pin_write(ETH_RESET_PIN, PIN_HIGH);
|
||||
}
|
||||
|
||||
//242.16 KB /51556-64564-70868 add ETH
|
||||
|
@ -301,11 +301,11 @@ extern "C"
|
||||
*
|
||||
*/
|
||||
|
||||
/*#define BSP_USING_ETH*/
|
||||
#define BSP_USING_ETH
|
||||
#ifdef BSP_USING_ETH
|
||||
/*#define PHY_USING_LAN8720A*/
|
||||
/*#define PHY_USING_DM9161CEP*/
|
||||
/*#define PHY_USING_DP83848C*/
|
||||
#define PHY_USING_DP83848C
|
||||
#endif
|
||||
/*-------------------------- ETH CONFIG END --------------------------*/
|
||||
|
||||
@ -369,6 +369,14 @@ extern "C"
|
||||
|
||||
/*#define BSP_USING_ON_CHIP_FLASH*/
|
||||
|
||||
|
||||
#define LED_HEART GET_PIN(E,3)
|
||||
#ifndef ETH_RESET_PIN
|
||||
#define ETH_RESET_PIN GET_PIN(E, 7)//71
|
||||
#endif
|
||||
////#define RESET_LB GET_PIN(E, 1)
|
||||
////#define RESET_UB GET_PIN(E, 0)
|
||||
////#define RESET_CE GET_PIN(G, 10)
|
||||
/*-------------------------- ON_CHIP_FLASH CONFIG END --------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -57,7 +57,7 @@
|
||||
/* #define HAL_DAC_MODULE_ENABLED */
|
||||
/* #define HAL_DCMI_MODULE_ENABLED */
|
||||
/* #define HAL_DMA2D_MODULE_ENABLED */
|
||||
/* #define HAL_ETH_MODULE_ENABLED */
|
||||
#define HAL_ETH_MODULE_ENABLED
|
||||
/* #define HAL_NAND_MODULE_ENABLED */
|
||||
/* #define HAL_NOR_MODULE_ENABLED */
|
||||
/* #define HAL_PCCARD_MODULE_ENABLED */
|
||||
|
35
rtconfig.h
35
rtconfig.h
@ -107,6 +107,7 @@
|
||||
#define RT_USING_SERIAL_V1
|
||||
#define RT_SERIAL_USING_DMA
|
||||
#define RT_SERIAL_RB_BUFSZ 4096
|
||||
#define RT_USING_PHY
|
||||
#define RT_USING_PIN
|
||||
#define RT_USING_ADC
|
||||
#define RT_USING_RTC
|
||||
@ -140,6 +141,40 @@
|
||||
|
||||
/* Network */
|
||||
|
||||
#define RT_USING_LWIP
|
||||
#define RT_USING_LWIP212
|
||||
#define RT_USING_LWIP_VER_NUM 0x20102
|
||||
#define RT_LWIP_MEM_ALIGNMENT 4
|
||||
|
||||
/* Static IPv4 Address */
|
||||
|
||||
#define RT_LWIP_IPADDR "192.168.0.30"
|
||||
#define RT_LWIP_GWADDR "192.168.0.1"
|
||||
#define RT_LWIP_MSKADDR "255.255.255.0"
|
||||
/* end of Static IPv4 Address */
|
||||
#define RT_LWIP_TCP
|
||||
#define RT_MEMP_NUM_NETCONN 4
|
||||
#define RT_LWIP_PBUF_NUM 4
|
||||
#define RT_LWIP_RAW_PCB_NUM 4
|
||||
#define RT_LWIP_UDP_PCB_NUM 4
|
||||
#define RT_LWIP_TCP_PCB_NUM 4
|
||||
#define RT_LWIP_TCP_SEG_NUM 40
|
||||
#define RT_LWIP_TCP_SND_BUF 4096
|
||||
#define RT_LWIP_TCP_WND 4096
|
||||
#define RT_LWIP_TCPTHREAD_PRIORITY 10
|
||||
#define RT_LWIP_TCPTHREAD_MBOX_SIZE 8
|
||||
#define RT_LWIP_TCPTHREAD_STACKSIZE 1024
|
||||
#define RT_LWIP_ETHTHREAD_PRIORITY 12
|
||||
#define RT_LWIP_ETHTHREAD_STACKSIZE 1024
|
||||
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 8
|
||||
#define LWIP_NETIF_STATUS_CALLBACK 1
|
||||
#define LWIP_NETIF_LINK_CALLBACK 1
|
||||
#define SO_REUSE 1
|
||||
#define LWIP_SO_RCVTIMEO 1
|
||||
#define LWIP_SO_SNDTIMEO 1
|
||||
#define LWIP_SO_RCVBUF 1
|
||||
#define LWIP_SO_LINGER 0
|
||||
#define LWIP_NETIF_LOOPBACK 0
|
||||
/* end of Network */
|
||||
|
||||
/* Utilities */
|
||||
|
Loading…
Reference in New Issue
Block a user