W7500 SPI Slave모드 질문합니다.
MCU & Boards
No replies yet. Be the first to reply.
Join the discussion.
MCU & Boards
No replies yet. Be the first to reply.
Join the discussion.
Share projects and connect with makers.
Joined before the site update? first.
New to WIZnet Makers?
We sent a verification link to your address. Open it to activate your account, then log in.
Accounts from this email provider are reviewed by an administrator after verification. Approval usually takes one business day.
Already have an account?
Enter your email address. If it belongs to an account, we'll send a link to set a new password. Members who joined before the site update use this to set their password.
If an account uses that address, we sent a link to set a new password. The link works once and expires in 30 minutes.
Know your password?
Need an account?
RE: W7500 SPI Slave모드 질문합니다.
by TheoIm WIZnet ·
안녕하세요, WIZnet Theo입니다.
아래는 제가 Slave 모드를 W7500 코드를 이용해 구현한 코드입니다.
정상적으로 수신 동작을 확인한 코드여서 한 번 사용해보시고 동일한 증상이 있는지 알려주세요.
/* Includes ------------------------------------------------------------------*/
#include “main.h”
#include “w7500x_ssp.h”
/* Private function prototypes -----------------------------------------------/
void delay_ms(__IO uint32_t nCount);
static void UART_Config(void);
void SSP1_Slave_Init(void);
/ Private functions ---------------------------------------------------------*/
/**
@brief Main Function
*/
int main()
{
uint16_t slaveRxData = 0;
/* Set Systme init */
SystemInit();
UART_Config();
printf(“W7500x Standard Peripheral Library version : %d.%d.%d\r\n”, __W7500X_STDPERIPH_VERSION_MAIN, __W7500X_STDPERIPH_VERSION_SUB1, __W7500X_STDPERIPH_VERSION_SUB2);
printf(“SourceClock : %d\r\n”, (int) GetSourceClock());
printf(“SystemClock : %d\r\n”, (int) GetSystemClock());
SSP1_Slave_Init();
int i = 0;
for(i=0; i<5000;i++){
while(SSP_GetFlagStatus(SSP1, SSP_FLAG_RNE) == RESET);
slaveRxData = SSP_ReceiveData(SSP1);
printf(“slaveRxData: %#04x\r\n”, slaveRxData);
}
}
/**
*/
void delay_ms(__IO uint32_t nCount)
{
volatile uint32_t delay = nCount * 2500; // approximate loops per ms at 24 MHz, Debug config
for(; delay != 0; delay–)
__NOP();
}
void SSP1_Slave_Init(void) {
SSP_InitTypeDef SSP_InitStructure;
/*
<SSP1 PORT & PIN NUMBER>
- SSP1 SSEL (PB.00) Pin
- SSP1 SCLK (PB.01) Pin
- SSP1 MISO (PB.02) Pin
- SSP1 MOSI (PB.03) Pin
*/
}
static void UART_Config(void)
{
UART_InitTypeDef UART_InitStructure;
#if defined (USE_WIZWIKI_W7500_EVAL)
UART_Init(UART1, &UART_InitStructure);
UART_Cmd(UART1, ENABLE);
#else
S_UART_Init(115200);
S_UART_Cmd(ENABLE);
#endif
}
#ifdef USE_FULL_ASSERT
/**
@brief Reports the name of the source file and the source line number
@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