RTL8720(BW16) - Wiz5500 communication

Hi,

I am trying to make an RT8720(bw16) talk to Wiz5500 using SDK 3.1.7.

I upload the following code quite successfully after compilation.


#include <Arduino.h>
#include <SPI.h>

byte reg_Data = 0;



void setup() {

pinMode(9, OUTPUT);
SPISettings my_spi(40000000, MSBFIRST, 0);// SPI setup, 40 MHz clock speed
  
   Serial.begin(115200);
   Serial.println("VERSIONR Register Test!"); 
   
   SPI.begin(9);
   delay(1); 
    
}

void loop() {

  address = VERSIONR;

  read_reg(address, control);
    
  Serial.print("VERSIONR Address -- ");
  
  Serial.println (VERSIONR, HEX);
    
  Serial.print ("CONTROL -- ");
  Serial.println (control);

  Serial.print ("VERSIONR -- ");
  Serial.println (reg_Data, DEC);
 
 reg_Data = 255;
  Serial.println (); Serial.println ();
  
delay(5000);

}

//==================================
byte read_reg(uint16_t address, byte control){

SPISettings my_spi(40000000, MSBFIRST, 0);// SPI setup, 40 MHz clock speed
  
  digitalWrite(9, HIGH);
  digitalWrite(9, LOW);
  Serial.println (reg_Data, DEC);  
     SPI.beginTransaction(my_spi);

     SPI.transfer16(0x0039);
     
     SPI.transfer( 0x00);
     reg_Data = SPI.transfer(0,SPI_LAST);

 digitalWrite(9, HIGH);    
 SPI.endTransaction();
   
 return(reg_Data);
}
//============================
}

The result screenshot is shown below. The VERSIONR returned is 1. As per datasheet of the Wiz5500 it should be 4.

Please advise what is it that I am not doing correctly.

Regards
azhaque

why not use the Ethernet library?

Thanks for the reply Juraj.

Infact your library was the first one I tried. However it does not compile. I tried usserr library by adapting it but that didnt work either. Adafruit also didn't work.

Realtek have not released a library for Ethernet for BW16. Therefore I am using their SPI.h and SPI.cpp.

Azhaque

if it is an Arduino and it has SPI library then the Ethernet library must work.
what error did you get?

I cannot recall the exact error message when I used your library since it was over a month ago.

If you can extend detailed help, I can certainly try using your library and share the error messages.

Azhaque

Error message from using your library with LinkStatus.ino.

the Ameba core is missing UDP.h. just copy it from any other core.

Ok. Will do and report

Andrassy
Did as you advised.

Exactly the same error as before

you copied

\Users\M1\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino\Udp.h

to

\Users\M1\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.7\cores\ambd\Udp.h

and you still get he same error "expected class-name before '{' token"?

Yes. Exactly the same

Juraj

My project objective does not need a full blooded Ethernet library. All I want is to create a very simple bridge between the 5GHz wifi of the BW16, and the ethernet port of the wiz5500 module, that will pass data back and forth.

You will appreciate that the BW16 module is very meagre in resources. The module that I have has 2 MB flash. The simple 10 line sketch to read the VERSIONR register of the 5500 takes up 10% of program space. So I need a simple sketch possibly without recourse to libraries, that will pass tcp/ip data wifi -> ethernet and ethernet -> wifi. Need at the most 2 sockets.

Hopefully the above could fit into 2 MB. If not I can increase flash to 4MB by changing the chip in the module.

I hope I have been able to explain. All this may oversimplistic to an expert like yourself, but that is all that is needed.

The real strength of the BW16 is 5GHz. I dont know of any other uC that is cost effective and has 5GHz. The ESP32-C5 has it, but its still in the pipeline for the last 2 yrs, with no indication when it is expected to come out on our end of the pipe.

Azhaque

so the Ethernet library will not help with that.
I don't know if it is even possible.
the W5500 will have to have the same MAC address as the WiFi interface.
the code must set both devices to MAC level mode and then exchange the network layer packets between the devices.
and the W5500 is slow.

Thanks for sharing your thoughts Juraj. This is very very fruitful discussion for me.

I am not to clear about the mac address system, can't add any value on that part of your post.

My idea is to use SPI for the transfer between the BW16 and the 5500. Following is the model:

  1. A send/recieve buffer of 4-5 KB created on the bw16. This utility of this buffer is to hold incoming and outgoing data.

  2. Create 2 socket buffers on the 5500. This is a simple enough task.

  3. Data coming on the bw16 wifi is held in the BUFFER created in (1) above. It is then sent to the 5500 using SPI. Similarly data recieved by 5500 is held in the socket buffer and transferred to bw16 again using SPI. I am pretty sure this method is used in the Ethernet libraries including yours.

Mac addresses, do not come into play as I see it. These will have to be included so that both wifi and 5500 can be initialized as per ieee recommendations.

Azhaque

the "network link" (a.k.a. MAC 'level') packets (frames) have some header. the header is managed by the devices so just throwing the packet content from one device to other may work.

Great.
If you feel that is the way fwd please guide what I should read and make a test sketch.

Azhaque

Incidently there is no alternative route. Each packet coming from wifi goes to 5500 socket. Conversely packets coming from 5500 only have one place to go- the wifi buffer of the bw16.

Thus most of the address and related fields don't mean much for the bw16<> 5500 transaction. So it would just be a copy-paste operation.

Azhaque

And the bottom line is that its all going to happen using SPI.

Azhaque

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.