[STM32F4] W5100/W5200 TPC/IP Loopback 전송 속도 테스트
SPI 최대 클럭 21Mhz에서 3.5Mbps 정도 나온다.
빠르긴 한데.. 아쉬운 점은 168Mhz MCU인데 속도가 기대한 만큼은 나오지 않는것 같다.
(PIC32 CP/IP 전송 속도 테스트 결과 와 비교하면 80Mhz PIC32가 더 빠르게 나온다)
SPI클럭 설정을 좀더 자유롭게 할 수 있으면 좋을것 같은데....
SPI FIFO가 없어 그런것 같은데... DMA를 이용하면 좀더 빨라지지 않을까?
------------------------------------------------------------
[7] iInChip Send: 3.5567 Mbps(5278574 bytes, 11.3230 sec)
iInChip Recv: 3.5074 Mbps(5278574 bytes, 11.4822 sec)
------------------------------------------------------------
[8] iInChip Send: 3.5647 Mbps(5278574 bytes, 11.2975 sec)
iInChip Recv: 3.3565 Mbps(5278574 bytes, 11.9982 sec)
--------------------------------------------------------
Cortex-M4 STM32F405 의 W5200 HAL Driver 코드
SPI 최대 클럭 21Mhz에서 3.5Mbps 정도 나온다.
빠르긴 한데.. 아쉬운 점은 168Mhz MCU인데 속도가 기대한 만큼은 나오지 않는것 같다.
(PIC32 CP/IP 전송 속도 테스트 결과 와 비교하면 80Mhz PIC32가 더 빠르게 나온다)
SPI클럭 설정을 좀더 자유롭게 할 수 있으면 좋을것 같은데....
SPI FIFO가 없어 그런것 같은데... DMA를 이용하면 좀더 빨라지지 않을까?
------------------------------------------------------------
[7] iInChip Send: 3.5567 Mbps(5278574 bytes, 11.3230 sec)
iInChip Recv: 3.5074 Mbps(5278574 bytes, 11.4822 sec)
------------------------------------------------------------
[8] iInChip Send: 3.5647 Mbps(5278574 bytes, 11.2975 sec)
iInChip Recv: 3.3565 Mbps(5278574 bytes, 11.9982 sec)
--------------------------------------------------------
Cortex-M4 STM32F405 의 W5200 HAL Driver 코드
//-----------------------------------------------------------------------------
// W5100 HAL
#define _SPI1_ENABLE 1
#define W5100_CS_PORT GPIOB
#define W5100_CS_BIT BIT12
#define W5100_RST_PORT GPIOA
#define W5100_RST_BIT BIT0
#define IINCHIP_RSToff() cbi(W5100_RST_PORT, W5100_RST_BIT)
#define IINCHIP_RSTon() sbi(W5100_RST_PORT, W5100_RST_BIT)
#define W5100_IO_INIT() RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA|RCC_AHB1Periph_GPIOB, ENABLE);\
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;\
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;\
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;\
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;\
GPIO_InitStructure.GPIO_Pin=W5100_CS_BIT;\
GPIO_Init(GPIOB, &GPIO_InitStructure);\
GPIO_InitStructure.GPIO_Pin=W5100_RST_BIT;\
GPIO_Init(GPIOA, &GPIO_InitStructure);
#define IINCHIP_CSoff() cbi(W5100_CS_PORT, W5100_CS_BIT)
#define IINCHIP_CSon() sbi(W5100_CS_PORT, W5100_CS_BIT)
#define IINCHIP_SPI_INIT() SPI1_Init();IINCHIP_SpiSpeed()
#define IINCHIP_SpiSendData SPI1_WriteReadByte
#define IINCHIP_SpiRecvData SPI1_WriteReadByte
#define IINCHIP_SpiSpeed() SPI1_SetSpeed(SPI_SPEED_MAX)
//-----------------------------------------------------------------------------
// W5100 HAL
#define _SPI1_ENABLE 1
#define W5100_CS_PORT GPIOB
#define W5100_CS_BIT BIT12
#define W5100_RST_PORT GPIOA
#define W5100_RST_BIT BIT0
#define IINCHIP_RSToff() cbi(W5100_RST_PORT, W5100_RST_BIT)
#define IINCHIP_RSTon() sbi(W5100_RST_PORT, W5100_RST_BIT)
#define W5100_IO_INIT() RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA|RCC_AHB1Periph_GPIOB, ENABLE);\
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;\
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;\
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;\
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;\
GPIO_InitStructure.GPIO_Pin=W5100_CS_BIT;\
GPIO_Init(GPIOB, &GPIO_InitStructure);\
GPIO_InitStructure.GPIO_Pin=W5100_RST_BIT;\
GPIO_Init(GPIOA, &GPIO_InitStructure);
#define IINCHIP_CSoff() cbi(W5100_CS_PORT, W5100_CS_BIT)
#define IINCHIP_CSon() sbi(W5100_CS_PORT, W5100_CS_BIT)
#define IINCHIP_SPI_INIT() SPI1_Init();IINCHIP_SpiSpeed()
#define IINCHIP_SpiSendData SPI1_WriteReadByte
#define IINCHIP_SpiRecvData SPI1_WriteReadByte
#define IINCHIP_SpiSpeed() SPI1_SetSpeed(SPI_SPEED_MAX)
//-----------------------------------------------------------------------------
반응형