|
DP83848與STM32F4進(jìn)行網(wǎng)絡(luò)通信電路原理圖如下:
0.jpg (61.15 KB, 下載次數(shù): 54)
下載附件
2019-10-13 17:45 上傳
單片機(jī)源程序如下:
- /* Includes ------------------------------------------------------------------*/
- #include "stm32f4x7_eth.h"
- #include "netconf.h"
- #include "main.h"
- #include "lwip/tcp.h"
- #include "serial_debug.h"
- #include "udp_echoclient.h"
- /* Private typedef -----------------------------------------------------------*/
- /* Private define ------------------------------------------------------------*/
- #define SYSTEMTICK_PERIOD_MS 10
- /*--------------- LCD Messages ---------------*/
- //#if defined (STM32F40XX)
- //#define MESSAGE1 " STM32F40/41x "
- //#elif defined (STM32F427X)
- //#define MESSAGE1 " STM32F427x "
- //#endif
- //#define MESSAGE2 " STM32F-4 Series "
- //#define MESSAGE3 " UDP echoclient Demo"
- //#define MESSAGE4 " "
- /* Private macro -------------------------------------------------------------*/
- /* Private variables ---------------------------------------------------------*/
- __IO uint32_t LocalTime = 0; /* this variable is used to create a time reference incremented by 10ms */
- uint32_t timingdelay;
- /* Private function prototypes -----------------------------------------------*/
- //void LCD_LED_BUTTON_Init(void);
- /* Private functions ---------------------------------------------------------*/
- /**
- * @brief Main program.
- * @param None
- * @retval None
- */
- int main(void)
- {
- /*!< At this stage the microcontroller clock setting is already configured to
- 168 MHz, this is done through SystemInit() function which is called from
- startup file (startup_stm32f4xx.s) before to branch to application main.
- To reconfigure the default setting of SystemInit() function, refer to
- system_stm32f4xx.c file
- */
- NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
- //#ifdef SERIAL_DEBUG
- // DebugComPort_Init();
- //#endif
- // /*Initialize LCD and Leds */
- // LCD_LED_BUTTON_Init();
- /* Configure ethernet (GPIOs, clocks, MAC, DMA) */
- ETH_BSP_Config();
- /* Initilaize the LwIP stack */
- LwIP_Init();
- /* Infinite loop */
- while (1)
- {
-
- /* check if any packet received */
- if (ETH_CheckFrameReceived())
- {
- /* process received ethernet packet */
- LwIP_Pkt_Handle();
- }
- /* handle periodic timers for LwIP */
- LwIP_Periodic_Handle(LocalTime);
- udp_echoclient_connect();
- }
- }
- /**
- * @brief Inserts a delay time.
- * @param nCount: number of 10ms periods to wait for.
- * @retval None
- */
- void Delay(uint32_t nCount)
- {
- /* Capture the current local time */
- timingdelay = LocalTime + nCount;
- /* wait until the desired delay finish */
- while(timingdelay > LocalTime)
- {
- }
- }
- /**
- * @brief Updates the system local time
- * @param None
- * @retval None
- */
- void Time_Update(void)
- {
- LocalTime += SYSTEMTICK_PERIOD_MS;
- }
- ///**
- // * @brief Initializes STM324xG-EVAL's LCD, LEDs and push-buttons resources.
- // * @param None
- // * @retval None
- // */
- //void LCD_LED_BUTTON_Init(void)
- //{
- //#ifdef USE_LCD
- // /* Initialize the STM324xG-EVAL's LCD */
- // STM324xG_LCD_Init();
- //#endif
- // /* Initialize STM324xG-EVAL's LEDs */
- // STM_EVAL_LEDInit(LED1);
- // STM_EVAL_LEDInit(LED2);
- // STM_EVAL_LEDInit(LED3);
- // STM_EVAL_LEDInit(LED4);
- // /* Leds on */
- // STM_EVAL_LEDOn(LED1);
- // STM_EVAL_LEDOn(LED2);
- // STM_EVAL_LEDOn(LED3);
- // STM_EVAL_LEDOn(LED4);
- //#ifdef USE_LCD
- // /* Clear the LCD */
- // LCD_Clear(Black);
- // /* Set the LCD Back Color */
- // LCD_SetBackColor(Black);
- // /* Set the LCD Text Color */
- // LCD_SetTextColor(White);
- // /* Display message on the LCD*/
- // LCD_DisplayStringLine(Line0, (uint8_t*)MESSAGE1);
- // LCD_DisplayStringLine(Line1, (uint8_t*)MESSAGE2);
- // LCD_DisplayStringLine(Line2, (uint8_t*)MESSAGE3);
- // LCD_DisplayStringLine(Line3, (uint8_t*)MESSAGE4);
- //#endif
- //
- // STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_EXTI);
- //}
- //#ifdef USE_FULL_ASSERT
- ///**
- // * @brief Reports the name of the source file and the source line number
- // * where the assert_param error has occurred.
- // * @param file: pointer to the source file name
- // * @param line: assert_param error line source number
- // * @retval None
- // */
- //void assert_failed(uint8_t* file, uint32_t line)
- //{
- // /* User can add his own implementation to report the file name and line number,
- // ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
- // /* Infinite loop */
- // while (1)
- // {}
- //}
- //#endif
- /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
復(fù)制代碼
所有資料51hei提供下載:
DP83848-ST(2).7z
(1.22 MB, 下載次數(shù): 84)
2019-10-13 17:45 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
DP83848C原理圖.pdf
(173.89 KB, 下載次數(shù): 66)
2019-10-12 15:17 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
|
評(píng)分
-
查看全部評(píng)分
|