Skip to content

Ethernet-to-serial/RS485 configured with W5500 and KL27

Ethernet-to-serial/RS485 configured with W5500 and KL27

WIZnet

Published May 02, 2023

Original author: eefocusOriginal source (new tab)

Ethernet-to-serial/RS485 configured with W5500 and KL27

Components

Hardware components

WIZnet parts

Project description

使用W5500+KL27实现以太网转串口RS232、RS485透传功能: 将W5500的库移植到工程中,然后就是初始化KL27的SPI: void w5500_spi_init() { PORT_Init(PORTB, PORT_MODULE_ALT1_MODE, PIN_0|PIN_1, 0, NULL); //PTB0 - SPI1_RST -> W5500 RST GPIO_Init(GPIOB, GPIO_PIN_OUTPUT, PIN_0); GPIO_Clr (GPIOB, PIN_0); delay(0xfff); GPIO_Set (GPIOB, PIN_0); delay(0xffff); GPIO_Init (GPIOB, GPIO_PIN_INPUT,PIN_1); PORT_Init(PORTD, PORT_MODULE_ALT1_MODE, PIN_4, 0, NULL); //PTB0 - SPI1_RST -> W5500 RST GPIO_Init(GPIOD, GPIO_PIN_OUTPUT, PIN_4); GPIO_Set (GPIOD, PIN_4); //SPI1 PTD4/5/6/7 CS/SCK/MOSI/MISO PORT_Init(PORTD, PORT_MODULE_ALT2_MODE, PIN_5|PIN_6|PIN_7…

Keep reading with a free account

Guests can read 15 projects per visit. Log in or create a free account to read the full description, open the documents and join the comments.