W5300 UDP init problem

Dear Friends!

I have problem with UDP initialization on W5300
I Do the following:

  1. nRESET pin hold in low 10
  2. After nRESET release(going to HIGH) wait 10 ms
  3. Write to MR (address 0x000) = 0x0000 ;
  4. Write to IMR (address 0x004) = 0x70FE ;
  5. Write to SHAR (address 0x008) = 0x0008 ;
  6. Write to SHAR2 (address 0x00A) = 0xDC01 ;
  7. Write to SHAR4 (address 0x00C) = 0x0203 ;
  8. Write to GAR (address 0x010) = 0xA9FE ;
  9. Write to GAR2 (address 0x012) = 0xD959 ;
  10. Write to SUBR (address 0x014) = 0xFFFF ;
  11. Write to SUBR2 (address 0x016) = 0x0000 ;
  12. Write to SIPR (address 0x018) = 0xA9FE ;
  13. Write to SIPR2 (address 0x01A) = 0xD957 ;
  14. Write to RTR (address 0x01C) = 0x0FA0 ;
  15. Write to RCR (address 0x01E) = 0x0007 ;
  16. Write to MTYPER (address 0x30) = 0x00FF ;
  17. Write to TMS01R (address 0x20) = 0x400 ;
  18. Write to RMS01R (address 0x028) = 0x0C00 ;
  19. Write to S0_MR (address 0x200) = 0x0002 ;
  20. Write to S0_IMR (address 0x204) = 0x0011 ;
  21. Write to S0_DIP (address 0x214) = 0x0000 ;
  22. Write to S0_DIP2 (address 0x216) = 0x0000 ;
  23. Write to S0_PORTR (address 0x20A) = 0x1388 ;
  24. Write to S0_DPORTR (address 0x212) = 0x1388 ;
  25. Write to S0_CR (address 0x202) = 0x0001 ;

After that I read S0_CR and S0_SSR

S0_CR shows -LISTEN and S0_SSR doesnt show SOCK_UDP

But W5300 can ping

Please someboby help!
I suppose that the problem in my addressation

Also after that Im trying to send the data but Wireshark doesnt show the UDP transaction
My ipconfig /all - Скачать 456.jpg - My-Files.SU

Hi~
What is the BIT16EN pin set to?
and could you please tell me the used interface?(For example, use the indirect bus)
What do you show when you read the S0_TTLR?
If you don’t write S0_TTLR, you can read 0x80.

thanks,
best regards,
irina

Dear Irina!
Thank you for your replay and support!
I used direct bus and set BIT16EN pin to HIGH level
Also I read 0x80 from S0_MR
Now I have problems with initialization of UDP mode
But I can ping the device
I do the following:

  1. nRESET pin hold in low 10
  2. After nRESET release(going to HIGH) wait 10 ms
  3. Write to S0_CR (address 0x202) = 0x0010 ;
  4. Write to MR (address 0x000) = 0x0000 ;
  5. Write to IMR (address 0x004) = 0x70FE ;
  6. Write to SHAR (address 0x008) = 0x0008 ;
  7. Write to SHAR2 (address 0x00A) = 0xDC01 ;
  8. Write to SHAR4 (address 0x00C) = 0x0203 ;
  9. Write to GAR (address 0x010) = 0xA9FE ;
  10. Write to GAR2 (address 0x012) = 0x0001 ;
  11. Write to SUBR (address 0x014) = 0xFFFF ;
  12. Write to SUBR2 (address 0x016) = 0x0000 ;
  13. Write to SIPR (address 0x018) = 0xA9FE ;
  14. Write to SIPR2 (address 0x01A) = 0x0003 ;
  15. Write to RTR (address 0x01C) = 0x0FA0 ;
  16. Write to RCR (address 0x01E) = 0x0007 ;
  17. Write to MTYPER (address 0x30) = 0x00FF ;
  18. Write to TMS01R (address 0x20) = 0x400 ;
  19. Write to RMS01R (address 0x028) = 0x0C00 ;
  20. Write to S0_IMR (address 0x204) = 0x0011 ;
  21. Write to S0_DIP (address 0x214) = 0xA9FE ;
  22. Write to S0_DIP2 (address 0x216) = 0xD955 ;
  23. Write to S0_DPORTR(address 0x212) = 0x1388 ;
  24. Write to S0_MR (address 0x200) = 0x0002 ;
  25. Write to S0_PORTR (address 0x20A) = 0x1388 ;
  26. Write to S0_CR (address 0x202) = 0x0001 ;

After that I just read S0_SSR (adress 0x208) on cycle and check its value on 0x0022
CS High level time is 210 ns during write and cyclic read

But INT value always on High level
And S0_SSR always 0x0001 - ARP

I checked that after writing to S0_CR, S0_CR cleared

Please help

Hi~

  1. Write to IMR (address 0x004) = 0x70FE ;

You must be set ‘1’ as bit 0, so you can see interrupt of the SOCKET 0.

  1. Write to S0_IMR (address 0x204) = 0x0011 ;

image
This value is the operation status of TCP.
You said, you want to use the UDP mode ,is it right?
If right, you have to set the RECV/TIMEOUT/SENDOK

And S0_SSR always 0x0001 - ARP

It is the status that ARP-request is transmitted in order to acquire destination hardware address.
This status is observed when SEND command is performed at the SOCK_UDP.
If hardware address is successfully acquired from destination(when ARP-response is received), it is changed to SOCK_UDP. If It’s failed and ARP timeout occurs(Sn_IR(TIMEOUT)= ‘1’), in case of UDP mode it goes back to previous status(SOCK_UDP)

You can see the network packet using the wireshark program.
If you use this program, you can confirm the status.
(For example, failed ARP-response…)

thank
best regards,
irina

Dear Irina!
Thanks a lot for your support

I have done all as you mentioned
And now I have got the following configuration to W5300

  1. nRESET pin hold in low 10
  2. After nRESET release(going to HIGH) wait 10 ms
  3. Write to MR (address 0x000) = 0x0000 ;
  4. Write to IMR (address 0x004) = 0x70FF ;
  5. Write to SHAR (address 0x008) = 0x0008 ;
  6. Write to SHAR2 (address 0x00A) = 0xDC01 ;
  7. Write to SHAR4 (address 0x00C) = 0x0203 ;
  8. Write to GAR (address 0x010) = 0xA9FE ;
  9. Write to GAR2 (address 0x012) = 0x0001 ;
  10. Write to SUBR (address 0x014) = 0xFFFF ;
  11. Write to SUBR2 (address 0x016) = 0x0000 ;
  12. Write to SIPR (address 0x018) = 0xA9FE ;
  13. Write to SIPR2 (address 0x01A) = 0x0003 ;
  14. Write to RTR (address 0x01C) = 0x0FA0 ;
  15. Write to RCR (address 0x01E) = 0x0007 ;
  16. Write to MTYPER (address 0x030) = 0xFFFF ;
  17. Write to TMS01R (address 0x020) = 0x4000 ;
  18. Write to TMS23R (address 0x022) = 0x0000 ;
  19. Write to TMS45R (address 0x024) = 0x0000 ;
  20. Write to TMS67R (address 0x026) = 0x0000 ;
  21. Write to RMS01R (address 0x028) = 0x0C00 ;
  22. Write to S0_IMR (address 0x204) = 0x001C ;
  23. Write to S0_DIP (address 0x214) = 0xA9FE ;
  24. Write to S0_DIP2 (address 0x216) = 0xD955 ;
  25. Write to S0_DPORTR(address 0x212) = 0x1388 ;
  26. Write to S0_MR (address 0x200) = 0x0002 ;
  27. Write to S0_PORTR (address 0x20A) = 0x1388 ;
  28. Write to S0_CR (address 0x202) = 0x0001 ;

My PC Ethernet adapter IPv4 address is 169.254.217.85 and Mask is 255.255.0.0
My PC Ethernet adapter VirtualBox IPv4 address is 169.254.48.96

I set up on W5300 configuration IP address 169.254.0.3 and for gate 169.254.0.1 and for mask 255.255.0.0

I attached Wireshark log

wiresharklog.pdf (395 KB)

Unfortunally, the situation is still the same

Hi~
Could you please try to test the next operation?

Write to S0_CR(address 0x202) == 0x0001(Socket open operation as UDP) → S0_SSR: SOCK_UDP
Read to S0_CR(address 0x202) → 0x0000
Write to S0_CR(address 0x202) == 0x0020(Send operation)
→ You can see the ARP request via wireshark program. And when completing the SEND process, S0_IR (SENDOK) becomes ‘1’.
After checking S0_IR(SENDOK) = ‘1’, the host can give SEND command to the next data.

thanks
best regards,
irina

Dear Irina!

Thanks a lot!

Now some is good)

I send data and received SEND_OK!)

But I dont understand why its working without SOCK_UDP establishing(without Socket initializtion of UDP )

Can you explain?, please

And can I continue without Socket initializtion of UDP further?

Sending Wireshark log

wiresharklog2.pdf (885 KB)

Sending current init + send flow

  1. nRESET pin hold in low 10
  2. After nRESET release(going to HIGH) wait 10 ms
  3. Write to MR (address 0x000) = 0x0000 ;
  4. Write to IMR (address 0x004) = 0x70FF ;
  5. Write to SHAR (address 0x008) = 0x0008 ;
  6. Write to SHAR2 (address 0x00A) = 0xDC01 ;
  7. Write to SHAR4 (address 0x00C) = 0x0203 ;
  8. Write to GAR (address 0x010) = 0xA9FE ;
  9. Write to GAR2 (address 0x012) = 0x0001 ;
  10. Write to SUBR (address 0x014) = 0xFFFF ;
  11. Write to SUBR2 (address 0x016) = 0x0000 ;
  12. Write to SIPR (address 0x018) = 0xA9FE ;
  13. Write to SIPR2 (address 0x01A) = 0x0003 ;
  14. Write to RTR (address 0x01C) = 0x0FA0 ;
  15. Write to RCR (address 0x01E) = 0x0007 ;
  16. Write to MTYPER (address 0x030) = 0xFFFF ;
  17. Write to TMS01R (address 0x020) = 0x4000 ;
  18. Write to TMS23R (address 0x022) = 0x0000 ;
  19. Write to TMS45R (address 0x024) = 0x0000 ;
  20. Write to TMS67R (address 0x026) = 0x0000 ;
  21. Write to RMS01R (address 0x028) = 0x0C00 ;
  22. Write to S0_IMR (address 0x204) = 0x001C ;
  23. Write to S0_DIP (address 0x214) = 0xA9FE ;
  24. Write to S0_DIP2 (address 0x216) = 0xD955 ;
  25. Write to S0_DPORTR(address 0x212) = 0x1388 ;
  26. Write to S0_MR (address 0x200) = 0x0002 ;
  27. Write to S0_PORTR (address 0x20A) = 0x1388 ;
  28. Write to S0_CR (address 0x202) = 0x0001 ;
  29. Write to S0_TX_WRSR(address 0x220) = 0x0001 ;
  30. Write to S0_TX_WRSR2(address 0x222) = 0x0000 ;
  31. Write to S0_TX_FIFOR(address 0x22E) = 0x1234 ;
  32. Write to S0_CR(address 0x202) = 0x0020 ;

Also Attaching Wireshark UDP printscreen

Hi addi

I saw the attached figure. W5300(169.254.217.3) send the UDP packet to 169.254.217.85, is it right?
I thank it operates as well.
UDP is different from TCP.
It initializes SOCKET 0 and Opens according to protocol type set in S0_MR(P3:P0)
when it sets S0_CR as OPEN command , S0_SSR according to S0_MR(P3:P0)
image

Therefore if you operate the UDP, SOCK_INIT of S0_SSR isn’t exist .

thank,
best regards,
irina

Yet another problem(

But the previous was done successfully , thanks to Irina

Now Ive noticed that I can not send more then one byte

The flow the same, except I send sequentually Word by Word to Tx_Fifo the data(92 Words).

Wireshark shows that UDP sending is absent, but when I store one Word to Fifo, It shows UDP sending with one sent Word and another more, wich I havent send
Please, help

Thanks in advance

Hi~ Addi

Sorry, for the late reply to your question.
You need to confirm the sending size or the socket buffer size when Socket init operate.

thanks,
BR
irina

Dear Irina!

Thank you for your replay!

Did you ment that TMSR and Sn_TX_WRSR must have the same values?

Now I write to TMSR 0x4000, to S0_TX_WRSR 0x00FF but futher before sending the data I read

FSR and it has status is not free

Now I cant send that I want to, even 15 words

Hi~ Addi

You means,
TX fifo size of Socket 0 is 64Kbytes, Tx_RSR size of Socket 0 is 255byte, is it right?
Could you tell me the S0_TX_FSR value?
It sets IP address and port number of the peer, saves the transmitting data in the internal
TX memory through Sn_TX_FIFOR, and tries to transmit the data to the peer.

thanks,
BR
irina

Dear Irina!

Thanks for your support!

I use direct bus and BIT16EN =1, also i can write to S0_TTLR, and can read what ive wtitten to.

And I write to S0_TTLR before open command

But the situation is still the same (…, free size reg shows not free

Dear Irina!

Declaring my proble more fully!

Im doing the folowing:

  1. nRESET pin hold in low 10

  2. After nRESET release(going to HIGH) wait 10 ms

  3. Write to MR (address 0x000) = 0x0000 ;

  4. Write to IMR (address 0x004) = 0x70FF ;

  5. Write to SHAR (address 0x008) = 0x0008 ;

  6. Write to SHAR2 (address 0x00A) = 0xDC01 ;

  7. Write to SHAR4 (address 0x00C) = 0x0203 ;

  8. Write to GAR (address 0x010) = 0xA9FE ;

  9. Write to GAR2 (address 0x012) = 0x0001 ;

  10. Write to SUBR (address 0x014) = 0xFFFF ;

  11. Write to SUBR2 (address 0x016) = 0x0000 ;

  12. Write to SIPR (address 0x018) = 0xA9FE ;

  13. Write to SIPR2 (address 0x01A) = 0x0003 ;

  14. Write to RTR (address 0x01C) = 0x0FA0 ;

  15. Write to RCR (address 0x01E) = 0x0007 ;

  16. Write to MTYPER (address 0x030) = 0x01FF ;

  17. Write to TMS01R (address 0x020) = 0x4000 ;

  18. Write to TMS23R (address 0x022) = 0x0000 ;

  19. Write to TMS45R (address 0x024) = 0x0000 ;

  20. Write to TMS67R (address 0x026) = 0x0000 ;

  21. Write to RMS01R (address 0x028) = 0x0800 ;

  22. Write to RMS23R (address 0x02A) = 0x0000 ;

  23. Write to RMS45R (address 0x02C) = 0x0000 ;

  24. Write to RMS67R (address 0x02E) = 0x0000 ;

  25. Write to S0_IMR (address 0x204) = 0x001C ;

  26. Write to S0_DIP (address 0x214) = 0xA9FE ;

  27. Write to S0_DIP2 (address 0x216) = 0xD955 ;

  28. Write to S0_DPORTR(address 0x212) = 0x1388 ;

  29. Write to S0_MR (address 0x200) = 0x0002 ;

  30. Write to S0_PORTR (address 0x20A) = 0x1388 ;

  31. Write to S0_TTLR (address 0x21E) = 0x0080 ;

  32. Read S0_TTLR (address 0x21E) = 0x0080;

  33. Write to S0_CR (address 0x202) = 0x0001 ;

  34. Read S0_TX_FSR2 (address 0x226) and check on value more than 192 bytes
    If true
    Write to FIFO 96 words and after that write to WRSR registes 192
    and after that write SEND command
    else
    Read S0_TX_FSR2 (address 0x226) and check on value more than 192 bytes again until true will reached

Hi~ addi

I will check the you use command for W5300.
I’ll let you know as soon as possible.

thanks,
BR
irina

Dear Irina!
Maybe you know worked algorithm of UDP data sending?
Thanks in advance

Hi Addi

After you send the data, could you check the Sn_IR(SENDOK) is ‘0’?
And the host can’t write data through S0_TX_FIFOR as the size bigger than S0_TX_FSR.

thanks,
BR
irina

Dear Irina!

Thank you!

I didnt understand what data FSR register shows

As I understand by default 0x00 and after writing to FIFO 1 byte it shows 1

Doesnt it?

And before next writing I must to wait 0 in FSR which will declare what 1 byte is sent