W7500P SPI관련문의
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: W7500P SPI관련문의
by becky ·
GPIOB 3번 Pin이 SPI cs 인가요?
sip_in에서는 cs 설정을 해주는데
spi_out에서는 cs 설정이 없네요
확인 해보시기 바랍니다.
RE: RE: W7500P SPI관련문의
by yongs1102 ·
답변 감사합니다.
위에 주석에서 설명한 것처럼 spi cs는 다른핀이고여 GPIOB pin3은 data를 읽는 time을 scope로 확인하기위해 임의의 핀을 설정해서 본것입니다.
spi_in()함수에서 SSP_ReceiveData()이 함수가 동작하는 시점을 보기위한것입니다. 확인결과 읽는 시점은 문제없어 보이고여…
현재 쓰는부분 spi wirite는 문제가 없어서 별도 내용을 추가하진 않은것입니다.
spi cs는 read_eeprom()함수에 있는 _EepCsLo();, _EepCsHi(); 이고여 GPIOB pin1입니다.
RE: W7500P SPI관련문의
by becky ·
SSP BaudRate Prescaler 는 2의 승수 값으로만 설정이 가능합니다.
40으로 설정시 정상적인 동작이 보장되지 않습니다.
#define SSP_BaudRatePrescaler_2 ((uint32_t)0x0002)
#define SSP_BaudRatePrescaler_4 ((uint32_t)0x0004)
#define SSP_BaudRatePrescaler_8 ((uint32_t)0x0008)
#define SSP_BaudRatePrescaler_16 ((uint32_t)0x0010)
#define SSP_BaudRatePrescaler_32 ((uint32_t)0x0020)
#define SSP_BaudRatePrescaler_64 ((uint32_t)0x0040)
#define SSP_BaudRatePrescaler_128 ((uint32_t)0x0080)
#define SSP_BaudRatePrescaler_254 ((uint32_t)0x00FE)
define 되어있는 값들이 있으니 해당값으로 수정하시 거나 0x40으로 수정하시길 바랍니다.
RE: W7500P SPI관련문의
by yongs1102 ·
위 말씀하신대로 아래처럼 수정하였으나 결과는 같습니다.
SSP0_InitStructure.SSP_BaudRatePrescaler = SSP_BaudRatePrescaler_64;
RS232로 받은 data를 보여드리면
rd : 65r rd : 0r rd : 0r rd : 0r rd : 65r rd : 0r rd : 0r rd : 0r rd : 0r rd : 0r
실제 0x65 값이 있고 scope로 확인해도 0x65가 확인되는데
data = (byte)SSP_ReceiveData(SSP0); 이 SSP_ReceiveData(SSP0) 함수로 읽는 값이 정상이 아닌것이 이유를 모르겠습니다.
RE: W7500P SPI관련문의
by irina WIZnet ·
while (SSP_GetFlagStatus (SSP0, SSP_FLAG_RNE) == SET) 으로 변경해주셔야할것 같습니다.
RNE flag는 1인 경우가 Receive FIFO에 데이터가 있는경우입니다.
RE: W7500P SPI관련문의
by yongs1102 ·
답변감사합니다.
말씀하신대로
while (SSP_GetFlagStatus (SSP0, SSP_FLAG_RNE) == SET):
이렇게 하면 이부분에서 나오지 못하고 무한루프상태입니다.
RE: W7500P SPI관련문의
by yongs1102 ·
추가로 말씀드리면 위 spi_in()함수는 W7500P_FW 예제중
SD_Card_LED중 mmc_sd.c에서
uint8_t bsp_readwritebyte_spi1 (uint8_t tx_data)
{
uint16_t retry=0;
/* Loop while DR register in not emplty /
while (SSP_GetFlagStatus (SSP1, SSP_FLAG_TNF) == RESET)
{
retry++;
if(retry>400)
return 0;
}
/ Send byte through the SPI1 peripheral /
SSP_SendData (SSP1, tx_data);
retry=0;
/ Wait to receive a byte */
while (SSP_GetFlagStatus (SSP1, SSP_FLAG_RNE) == RESET)
{
retry++;
}
이부분의 예제를 참고한것입니다.