Showing posts with label Ethernet. Show all posts
Showing posts with label Ethernet. Show all posts

Monday, August 15, 2016

Back to gateway

I have used my recent W5500 breadboard friendly PCB to overcome problem with W5500 directly on gateway. As you may know there is problem with packed loss during transmission, which make it nearly impossible to further debug other parts. I have soldered ISP header on the gateway and used is as SPI to attach W5500 PCB. This works just great! I'm back to 100MHz full duplex Ethernet business. With improvements to Webduino library and some other tweaks, it have gained on speed towards web clients, as well as more time to process things internally in RTOS.

I have stared to test input blocks. Digital ones are same as on old gateway, and tere is no surprise. However analogue part was redesigned, but first test shows it works as expected. I will have to test further what over voltage or shorts it can withstand. I'm happy with that, because I'm more digital then analogue guy :), or better yet software type :D.

I have noticed that during uploading new sketches into gateway, I toggle the GSM module On and Off. This is a bit of drag as you imagine. It could be solved further in software, but I have rather done some changes on pin assignment.  I have tossed out GSM_RESET, as it can be reset hard way by switching GSM_POWER. And change it to input pin reading GSM state (GSM_STATUS). This way software can recognise instantly during start-up if the GSM module is already On or Off.

Next I will test outputs and RS485 interface. Then check power supply fall back and real time battery backup. If all goes well, I'll release final version of new gateway, which I plan to sell as starting point to DIY home security for anyone interested.

Wednesday, June 15, 2016

Gateway progress

I have all components at home and I started already some tests. There are good results and bad results as well.

I'm happy to say, that my UART mux is working as I wanted it to work. There are 2 UARTs on ATmega1284P, one is used for GSM modem and second for RS485. Both need to be connected to hardware serial in order to have queue, interrupts  and other capabilities. But I keep compatibility with FTDI Arduino programmer, so I miss 3th serial. First I wanted to put jumpers to redirect serial 0 to GSM or FTDI, but later I have found nice little IC 74LVC1G3157 that is able to mux and demux one digital or analogue line to 2 outputs in both direction. With using the 3.3V present in FTDI it switches automatically from GSM to FTDI any time you connect the FTDI to header. Nice little trick.

New GSM module is working well, I have switched from external SIEMENS to more common SIM900. It did not send SMS, and I was not able to read extended status, but it was all matter of slightly different responses of the 2 modems to same AT commands. Some "/r" or adding empty line in library and all started to work. One thing that needs to be corrected on PCB for SIM900, is the placement of capacitor near GSM antenna connector. If one will put it in position toward the capacitor bank it can, with some bad luck, accidentally short 4V and ground. Hot glue will do will do for now, but I will move the capacitor 2-3 mm away. There is also SIM900 RESET connected to ATmega, which is most most probably unnecessary. I think rather to use it as input of  SIM900 STATUS to quickly see if module is ON or OFF.

Now the bad news, the Ethernet part is not working well, I keep on losing ACK or packets. Sadly I was expecting some problems there, as it requires differential traces tuned to some impedance and EMI reduction, I have sent the finished gerbers to friend to evaluate. Well, it turned out I have cross talk after the PHY. I'm absolutely not expert on such design, and I have no such equipment to debug 100Mbits Ethernet. But I have very slowly eliminated all to this hardware problem. Also lowering the speed to 10Mbits fairly lowered the error rate of my packets. All that is left is to try another brand MAGJACK.

All bad is for some good, I have tuned up Webduino code and W5500 library to use maximum bandwidth, and the embedded web server is now pretty fast, rising to over double the speed.

Rest is fine, I will just test the ADC protection circuit. For W5500 I will most probably design small 2,5 x 5 cm breadboard friendly PCB, not to waste another $50 for whole gateway board.

Thursday, May 14, 2015

GSM and uptime

Just today, I have accidentally discovered that the GSM service provider had
some problems with his network. Luckily the thread that check GSM status handled the network failure just well, and recovered from it without issues.

I have the system up and running for 96 days with all threads working. I
must say the NilRTOS is really robust.I'm planning some software updates, but I have to create remote ISP first.


Also recently I have got W5500 chip and Wiz550IO and I'm very tempted to create a new mainboard together with SIM900. This would be all included alarm board that can simply replace old alarms and offer many features with open firmware and hardware.

Wednesday, November 19, 2014

Short wires II / New PCB arrived

After taking some time to figure out what components died after the bead burned, I found the only one is the Ethernet module. One of the most expensive. This led me to adding extra protection to 3V3 power rail, a Zener diode which limit the voltage to 3.9V, I hope :)

But luckily all other components can be taken to new board that I have just received from factory. Next week I will get busy :)

Monday, October 20, 2014

Wiz820io power on problem.

Some months ago I have found that the wiz820io is not recovering correctly on power failure. There is needed to reset it after power on. Sadly I have connected the reset of atmega to wiz820io. There was two possible solutions I had on mind, first to use the Ethernet INT signal that is not used as separate reset, and second to add a watchdog chip to the board.

I went first with with the watchdog variant. I have found, and bought MCP130 which is a voltage supervisory device. It is designed to keep a micro controller in reset state until the system voltage has reached the proper level and it is stabilized. By looking at the schematic I have found that the R22 resistor, 10k reset pull-up, can be replaced by MPC130. The MPC130 is available in SOT-23 package and pins matches the footprint of R22 resistor except GND signal. I have replaced it and soldered extra wire form nearest ground to watchdog.

I happy to say that the watchdog keeps the reset long enough to satisfy the wiz820io and the main board is now recovering from complete power loss without any issue. Just for completeness the wiz820io has its own 10k pull-up.

If there will be some new revision of the main board, I will replace the R22 with  MCP130 and free the INT line to wiz820io for digital input. The price of MCP130 is 0.25 EUR for 1 piece in our local shop and it is well worth it :).




Friday, October 3, 2014

NTP synchronization

There is RTC circuit on the main board which is battery backed up. But it lacked the feature to set the correct time other then the compilation. As it has drifted a minute a month, or so, I guessed it is right time to make it synchronized with some NTP server.

I have put a button on the home page of the interface to get the correct time, as well as letting the service thread synchronize time when it starts.

It took me some hours to combine some examples on the net into working code, that I think is a bit optimized, and also working with the rest of threads and web-service. The changes are pushed to Git Hub.

On the Arduino forum is a good post about choosing the right NTP server, which is a valuable resource to read. Especially the attached link to Flawed Routers Flood University of Wisconsin Internet Time Server.