STM4xx에서 Sn_RX_RSR 읽기 문제

ST사의 STM4x7 MCU의 FSMC 버스에 W5300 을 interface해서 사용하고 있습니다.
다른 문제는 없고 아래 코드와 같이 RSR의 크기를 읽는 부분에서 약간의 문제가 있습니다.

I am using the W5300 interface to the FSMC bus of ST’s STM4x7 MCU.
There is no other problem, and there is a slight problem in reading the size of RSR as shown in the code below.

uint32 getSn_RX_RSR(SOCKET s)
{
uint32 received_rx_size=0;
uint32 received_rx_size1=1;
while(1)
{
received_rx_size = IINCHIP_READ(Sn_RX_RSR(s));
received_rx_size = (received_rx_size << 8) + IINCHIP_READ(Sn_RX_RSR1(s)); // read
received_rx_size = (received_rx_size << 8) + IINCHIP_READ(Sn_RX_RSR2(s));
received_rx_size = (received_rx_size << 8) + IINCHIP_READ(Sn_RX_RSR3(s));
if(received_rx_size == received_rx_size1) break;
delay(1msec); // <----------------- 여기에 delay가 없으면 이 함수를 무한 반복함.
// <----------------- If there is no delay here, this function will repeat indefinitely.
received_rx_size1 = received_rx_size; // if first == sencond, Sn_RX_RSR value is valid.
} // save second value into first
return received_rx_size;
}

처음 읽은 RSR의 값과 두번째 읽은 RSR의 값이 같아서 loop를 빠져나가야 하는데,
delay가 없으면 loop를 무한반복하게 됩니다.
원인이 무엇일까요?

The value of the first read RSR and the value of the second read RSR are the same,
If there is no delay, the loop repeats indefinitely.
What is the cause?

실제 값들을 확인하시고,
RSR 값이 설정된 Rx buffer 크기보다 큰 값들이 출력되는지 바랍니다.
RSR값은 Rx buffer 크기보다 큰 값을 가질 수 없으므로, 이런 값들이 출력이 된다면
Host Access Timing을 좀더 느리게 설정하셔서 테스트 부탁드립니다.

그리고, 한가지 더 의심스러운 것은 코드 Optimize로 인해 recv1값이 Update되지 않을 수 도 있습니다.
두 변수에 volatile를 선언해주세요.

감사합니다.