viernes, 30 de diciembre de 2016

Raspberry Pi zero OTG, ethernet. Not working? Solved

So i am working right now on a proyect, and a week ago i decided i would make it with a raspberry pi. I had 2 raspberry pis lying in my house, an raspberry pi b revision 1 (the first raspbery pi b) and a raspberry pi zero. I decided to use the raspberry pi zero because i wanted that my proyect wouldnt cost to much (5€, isnt that much or?) and i knew i could program it over usb OTG, even if i didnt had it tested before. There are plenty of guides to set the raspberry pi zero OTG as an ethernet conection, so i followed one of those.
So the first thing i did was to install the latest version of raspbian on the microsd card of my raspberry pi zero. I just formated  the microSD card with SDFormatter and then installed with  Win32Diskimager the latest  Raspbian Image. After installing it, i opened the boot partition of the SDcard, opened the file CONFIG.TXT and added at the very bottom dtoverlay=dwc2.

Then i closed it and opened the file CMDLINE.TXT and added after rootwait with just one space the comand modules-load=dwc2,g_ether i would recomend adding it with the notepad++
This way you can see u arent adding a new line. It is very important not adding a new line. The comand must be separated with just one space.

So after this i have read that u must create in the boot folder a folder named SSH so the conection works to your computer. Well... i think that is just witchcraft... i dont think it works that way. I mean... i tested it out and didnt work for me. At last i bought an OTG-Keyboard cable and an MiniHDMI cable to enable SSH. That didnt also work. But i found the reason. Anyway... after enabling the SSH via console in the raspi-config comand in my television, i saw that in my boot partion in the SDcard, was no SSH file or Folder. Test first my way, if it works, fine, if my way doesnt work, then test the other way. If it still doesnt work, then go buy an OTG cable to Keyboard and an MiniHDMI cable.

So, lets continue. After modifing the config.txt and cmdline.txt, install Bonjour, itunes or QuickTime to windows and then put the microSD in the raspberry pi ZERO, and connect the USB OTG port of the Raspbery pi Zero to your computer. Before u do this, u should open the device administrator of your computer.
Sorry it is in spanish
So now we have to see if the raspberry connects to the computer as a Serial Port or as an ethernet device.  In my case it was conecting as a Serial Port but i didnt know it and i couldnt find information about it.
If it conects as an RNDIS device, you should be able to connect yourself via putty as raspberrypi.local, anyway, lets continue.
As you can see, my laptop doesnt know it is actually a ethernet device. But dont worry...
There is a solution, even if you cant find it in internet. First download this file: RPI OTG DRIVER  and unzip it
Then do right click on Serial device and click the first option. It will open something like this:
Click what i have marked with the blue pencil, and search the file that you have unziped before
And press next. Windows will install the driver, and now it should appear in the device manager as a RNDIS Device
Now open putty and try to enter as raspberrypi.local, if it conects GREAT, if it doesnt, maybe you have to enable SSH


lunes, 14 de noviembre de 2016

Digispark, reset disable

A few weeks ago i bought some chinese digisparks, 3 for 6 bucks. Everything worked fine and i started playing with them. But there was a problem. I couldnt get a signal out of Pb5, and the analog converter ADC0 in Pb5, couldnt go under 2,45V because the attiny85 would reset.
It seems that chinese digisparks dont have the reset fuse disabled. So i started searching a way to set the fuses right. This is what i got:
First we need to install arduino ISP, on an arduino uno, or similar. You can get Arduino ISP on examples
     Arduino ISP program
Now you will need to conect the arduino to the digispark, with this configuration: 
GND-->GND
5v-->5v
10-->p5
11-->p0
12-->p1
13-->p2 
And you will need to connect  a 10uF capacitor to the reset of an arduino and to ground
Next step is to install AVRDUDESS.
Now you have to open it and set everything as it is on the image below
 AVRDUDESS
Now you have to press first "Detect" and if it recognises the attiny85, then you have to press in the box of "Fuses & lock bits"the first Read. You will get 3 hexadecimal values.
Then you have to take this values and put them in this Calculator. Put attiny85 as AVR, and put the values in their places

Later you have to press the bit 7 RSTDISBL, and put it to high, and recalculate.
 
There  will come new hexadecimal values, You have to copy them into the AVRDUDESS console, and press Write. After that your fake digispark will became a real digispark. Just try it, loading a blink program on Pb5