Hi Abhishek & Ashok,

There are multiple issues with Arduino Wifi implementation in CA layer 
implementation:

Note: These issues have been verified/reproduced in the latest patch set #9 of 
the "connectivity files" review as well. 
(https://gerrit.iotivity.org/gerrit/#/c/193/9/)


1.       There is no mention of using latest firmware version on Wifi Shield in 
any current documentation. The latest firmware found in the arduino 1.5.8 
package is required in order to use UDP ports. Our stack will not work without 
UDP.

2.       In connectivity/src/wifi_adapter/Arduino/cawificlient.cpp, 
CAWiFiSendData() method is trying to use Udp.beginPacket API which takes either 
:IPAddress datatype or a hostname. The first flavor is straight-forward and 
will send the data to that address. Second flavor will actually do a DNS search 
on that host name to discover ipaddress and then send data to that ip address. 
The latter is being used unintentionally. The is resulting in no return fron 
the DNS search.

3.       The are two copies of WiFiUDP object(one in cawifiserver.cpp and 
another in cawificlient.cpp). The one in cawificlient.cpp is never initialized 
to any socket....so it will not be able to send any data. There should be just 
one WiFiUDP object initialized and then both cawifiserver.cpp and 
cawificlient.cpp can use the same object for data transmission.

4.       The other issue is that the buffer between WiFi library and the WiFi 
shield is just 64 bytes. And therefore Udp.write cannot send data more than 
that ever. Please see below conclusion to see how this issue can be resolved.

5.       There is another subtle issue which we may not experience until we do 
some stress testing. If multiple UDP packets are received at WiFiShield, it's 
firmware cannot differentiate the boundaries and will try to give one big 
packet to ArduinoWiFi library. The Arduino library will assume that it got a 
big packet from sender 1...whereas it really received 4 packets from 4 
different senders.

During Intel's first visit to Korea with Samsung, Sachin Agrawal & Doug Hudson 
spent a lot of time to discover these issues with the WiFi Shield added fixes 
for points #2, #3,  and #4 in the implementation of ocsocket_arduino_wifi.cpp 
module that can still be found on latest master branch. Fix for #5 was added in 
WiFiShield firmware.

If the implementation for CA Layer with Arduino WiFi is working for some OIC 
members and not others, this means that:

1.       They either have a patch to Fix these issues somewhere and they forgot 
to add to GIT repo, OR

2.       They are using some other Wifi shield which does not exhibit these 
problems.

BTW, I have attached a modified version of cawificlient.cpp and 
cawifiserver.cpp which will allow you to send atleast 64 bytes of data :). 
Please verify you can use these modules for better performance with the Arduino 
WiFi Shield.

Thanks,

Sachin & Joey

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20150217/38f88d72/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cawificlient.cpp
URL: 
<http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20150217/38f88d72/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cawifiserver.cpp
URL: 
<http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20150217/38f88d72/attachment-0001.ksh>

Reply via email to