User avatar
DougieLawson
Posts: 36098
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: PiZero Ethernet pHAT

Mon Dec 21, 2015 5:48 pm

karrika wrote:NP. I send you an assembled one. :D

I use a hot plate and ordinary tin only. Look at the top of the thread.
Ah, that gives me the confidence to try a self-build. Nurse, pass me the forceps and the soldering iron.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: PiZero Ethernet pHAT

Mon Dec 21, 2015 5:58 pm

6by9 wrote:Ta. That is an impressively cheap price! It does make you wonder how they make any money at all.
Says he who works for helps a company producing a £4 computer!

User avatar
karrika
Posts: 1070
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: PiZero Ethernet pHAT

Mon Dec 21, 2015 6:04 pm

DougieLawson wrote:
karrika wrote:NP. I send you an assembled one. :D

I use a hot plate and ordinary tin only. Look at the top of the thread.
Ah, that gives me the confidence to try a self-build. Nurse, pass me the forceps and the soldering iron.
Great! First run just the tin on all SMD pads. Then just place the chips and apply heat - no more tin. If you burn the PCB I can send you some more. The pcb is cheap. I got 50 of them as the price is the same as getting just 10. So there is lots of extras.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7268
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: PiZero Ethernet pHAT

Mon Dec 21, 2015 6:09 pm

gregeric wrote:
6by9 wrote:Ta. That is an impressively cheap price! It does make you wonder how they make any money at all.
Says he who works for helps a company producing a £4 computer!
:D
£4 doesn't include shipping from China though (though Royal Mail/UK courier is probably more expensive), and they have to include the various magnetics for ethernet.
When you look at the cost price of the LAN9512 you realise why ethernet wasn't a option at the price point of the PiZero. I've got 3 of the Ebay adapters on order, so I might break one apart to see what chip they have used.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: PiZero Ethernet pHAT

Mon Dec 21, 2015 6:25 pm

Pimoroni have some, there's a naked picture of one in this video, but they don't do a full teardown / name that chip.

User avatar
karrika
Posts: 1070
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: PiZero Ethernet pHAT

Tue Dec 22, 2015 5:18 pm

Now I got some figures of the speed.

Download speed is 4.12Mbits/sec. Upload speed 3.09Mbits/sec. This was between the PiZero and a server in Helsinki.

My expensive ASUS laptop was not much better. Download speed 13.32Mbits/sec. Upload speed 3.34Mbits/sec.

Not bad for a cheap Chinese ENC28J60.

The headphones also worked after

gpio -g mode 12 ALT0
gpio -g mode 13 ALT0
omxplayer -o local example.mp3

And the sound volume was just right :)

As SMD component soldering is kind of tricky I could solder them on board. The 10-pin and 40-pin connectors are better to mail unsoldered as the cost for a flat letter is 4 € cheaper. So for 10€ (pcb, components soldered, pin headers unsoldered, 12mm spacers, 8 screws) + 2€ (shipping abroad) you can get Miscaps. There is no ENC28J60 module in this packet. You have to get that one from ebay. Drop me a line if you are interested.

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: PiZero Ethernet pHAT

Tue Dec 22, 2015 6:00 pm

Is there any discernible difference in speed between spi0/1? viewtopic.php?f=63&t=81736&p=587529#p587529

User avatar
karrika
Posts: 1070
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: PiZero Ethernet pHAT

Tue Dec 22, 2015 6:28 pm

I tested only the out-of-the-box solution on SPI0. You probably need to create some dt blob in the eeprom to assign the right bits. adun was going to help a bit with the SPI1 case.

My test was just a simple run of speedtest-cli. A real test should check the speeds towards the local net. I hope we get some figures after xmas when my testers get their stuff together.

Actually I was surprised that Massimos QLC+ image worked out of the box with the Ethernet module and also PiZero's analog TV out.

I added Miscap to my shop. http://discohat.com/shop/#!/Miscap/p/58 ... y=15290049

User avatar
karrika
Posts: 1070
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: PiZero Ethernet pHAT

Mon Dec 28, 2015 4:58 pm

Joe Schmoe wrote:
6by9 wrote:Where have you found this €6 adapter? It sounds quite useful, even if it does under cut your project as originally conceived.
http://www.dx.com/p/micro-usb-to-3-port ... ite-407265

$6.50 (USD)
I got this "micro-usb-3-port-usb-2-0-hub-rj45-interface-white-miracle". It installs nicely. You can ping and get an answer. Any real use cause a kernel panic. Always. Complete crap. It was cheap but worthless.

So back to Miscap.

User avatar
Douglas6
Posts: 4759
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: PiZero Ethernet pHAT

Mon Dec 28, 2015 5:03 pm

Grrrrrrr. I have one in the mail.

User avatar
karrika
Posts: 1070
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: PiZero Ethernet pHAT

Mon Dec 28, 2015 6:29 pm

I know the feeling. I also ordered a few different HUB's from China. They work with my laptop. But not a single one of them works with PiZero.

The only HUB+Ethernet I got to work with PiZero was a 20€ "Hubby USB2.0 High Speed ETHERNET+HUB from Fuj;Tech". The download speed was 13.64Mbits/sec and I could connect both the keyboard and mouse at the same time to it. And there is still one extra USB socket left.

So the USB is faster than SPI. Which was no surprise.

We should create a thread with working and non-working USB things.

Edit: appears to be working ok after a 30 min test. Still ok after running over night.

User avatar
karrika
Posts: 1070
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: PiZero Ethernet pHAT

Tue Dec 29, 2015 1:57 pm

I just created a golden enclosure for Miscap + PiZero. Due to recent budget cuts we don't really use gold. Just a printed folded cardboard. But with a little imagination it is a Golden Enclosure.

http://79.125.115.174/pics/MiscapGolden.pdf
http://79.125.115.174/pics/MiscapGolden.svg
Image

or if you want to have a blank box there is one here too

http://79.125.115.174/pics/MiscapPlain.pdf
http://79.125.115.174/pics/MiscapPlain.svg
Image

Actually I would like to host a competition for the best colouring of a Miscap box. The price will of course be a Miscap board. Where should I post a competition? And is there some voting mechanism for judging the best entry?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7268
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: PiZero Ethernet pHAT

Thu Dec 31, 2015 5:39 pm

Just my two-penneth on the cheap 3 port USB OTG hub and ethernet.
My three (Ebay from China) use the DM9601 chip, so I get hit by https://github.com/raspberrypi/linux/issues/1045 as soon as I try any significant transfers. Oh well, <£3 for a USB hub isn't a terrible price. I'll give it a whirl to see what throughput can be sustained.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
karrika
Posts: 1070
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: PiZero Ethernet pHAT

Sun Jan 03, 2016 2:38 pm

Hi guys. I finally had some time to test the LED snake and RGB matrix interface for my DiscoHAT. Unfortunately the enc28j60 module got in the way and stole the spi 0 interface. But by removing the dtoverlay for enc28j60 the DiscoHAT/DiscoCap works perfectly.

Image Image

I tried to google for the source code for the enc28j60.dtd to see if I could create a enc28j60-1.dtd file that could use the spi 1 instead and leave the spi 0 free for my lighting stuff. Any pointers?

How is the soldering going? If you need help drop me a line. I should get more chips next week and can still put a pre-soldered unit in the mail if required.

DirkS
Posts: 9936
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: PiZero Ethernet pHAT

Sun Jan 03, 2016 2:56 pm

karrika wrote:I tried to google for the source code for the enc28j60.dtd to see if I could create a enc28j60-1.dtd file that could use the spi 1 instead and leave the spi 0 free for my lighting stuff. Any pointers?
You need the .dts file. I think they're all at https://github.com/raspberrypi/linux/tr ... s/overlays

User avatar
karrika
Posts: 1070
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: PiZero Ethernet pHAT

Sun Jan 03, 2016 2:59 pm

Thank you :)
Just what I was looking for.

User avatar
adun
Posts: 102
Joined: Fri Mar 20, 2015 9:25 am
Location: Switzerland

Re: PiZero Ethernet pHAT

Sat Jan 16, 2016 1:14 am

So I finally had time to do some basic "beta" testing :)
And here are the results:

First the smd soldering was realy not that easy. Even I have some practical experience, it took me some time for all the components. And I think I have damaged a capacitor by applaying to much heat with a "heat-gun". I was happy when everything was done.

SPI Ethernet
I had some trouble getting the SPI module loaded. I got always 'ERROR: could not insert 'spi_bcm2708': No such device.
The solution for me was not to use NOOBS and instead use a clean raspbian image.
Then the enc28j60 module worked without any problem. I just added

Code: Select all

dtoverlay=enc28j60
to /boot/config.txt
and enabled SPI. In my configuration the SPI ethernet is eth1 as I have additionally a usb to ethernet adapter which is eth0.
I did a basic speedtest speedtest-cli --source [IP of eth] that gave me:

eth0 (usb ethernet): Download: 50.10 Mbit/s Upload: 4.85 Mbit/s
eth1 (spi ethernet): Download: 5.28 Mbit/s Upload: 4.83 Mbit/s

Second speed test on local net with iperf:

eth0 (usb ethernet):
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 97.6 MBytes 81.7 Mbits/sec

eth1 (spi ethernet):
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 40.0 MBytes 33.4 Mbits/sec

PWM Audio

Code: Select all

gpio -g mode 12 ALT0
gpio -g mode 13 ALT0
Just did the job and I was able to hear my test file with aplay. However I had some noice disturbance especially at high tonal sounds. I dont know if this is caused by some damaged components.
The volume was well adjustable by software.

I also had a quick check at the pwm-2ch overlay where we can set the pwm pins. I tried

Code: Select all

/dts-v1/;
/plugin/;

/*
This is the 2-channel overlay - only use it if you need both channels.

Legal pin,function combinations for each channel:
  PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0)            52,5(Alt1)
  PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1)

N.B.:
  1) Pin 18 is the only one available on all platforms, and
     it is the one used by the I2S audio interface.
     Pins 12 and 13 might be better choices on an A+, B+ or Pi2.
  2) The onboard analogue audio output uses both PWM channels.
  3) So be careful mixing audio and PWM.
*/

/ {
	fragment@0 {
		target = <&gpio>;
		__overlay__ {
			pwm_pins: pwm_pins {
				brcm,pins = <18 19>;
				brcm,function = <2 2>; /* Alt5 */
			};
		};
	};

	fragment@1 {
		target = <&pwm>;
		__overlay__ {
			pinctrl-names = "default";
			pinctrl-0 = <&pwm_pins>;
			status = "okay";
		};
	};

	__overrides__ {
		pin   = <&pwm_pins>,"brcm,pins:0";
		pin2  = <&pwm_pins>,"brcm,pins:4";
		func  = <&pwm_pins>,"brcm,function:0";
		func2 = <&pwm_pins>,"brcm,function:4";
		clock = <&clk_pwm>,"clock-frequency:0";
	};
};
For the final realase the best will be to set the PWM pins in the device tree overlay. And somehow merge the enc28j60 and pwm-2ch overlay together. I will do some further research/testing....

Mecanical Issue:
Just a little thing is that one screw can't be aplied because the rj45 port from the enc28j60 module get's in the way

Conclusion/Ideas
I wasn't able to test SPI1 mode because I could not finde any information about the SPI1 driver. I even dont know if one was written.
So I came up with the following: Recently I found out that the current RPi SPI driver, spi-bcm2835, supports GPIO pins as chip-selects. This means that any free GPIO can be used as another chip select :P
So as we need GPIO 7 (CE_0) and GPIO 8 (CE_1) for our devices/HAT why not use GPIO 6 as CE_2 for the enc28j60 module. That would allow us to have only one configuration mode, simplify the circuit and drop the need for the SPI1 switch. Additionally it would keep the I2S pins (GPIO 18-21) free for HD audio if needed ;)
Last edited by adun on Tue Feb 02, 2016 11:55 am, edited 3 times in total.

User avatar
karrika
Posts: 1070
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: PiZero Ethernet pHAT

Sat Jan 16, 2016 7:34 am

Hi adun,
thank you for the testing and suggestions. Obviously the soldering with very small chips is too hard so I may have to start shipping only completed Miscaps.
The DeviceTree stuff may still be broken for PiZero. The SPI1 may become a solution later. For me the use of SPI0 conflicts with the light control that needs the entire port. No CE tricks help me here.
The speed tests you did have very good results.
I will get my light control board for PiZero in early February. Hopefully I understand the dt programming by then :D

User avatar
adun
Posts: 102
Joined: Fri Mar 20, 2015 9:25 am
Location: Switzerland

Re: PiZero Ethernet pHAT

Sat Jan 16, 2016 11:05 am

Why do you need exactely the whole SPI0 port / how does your light control work? usually each device has a CE. If you need it as GPIO you could probably switch to others to leave it free...

User avatar
karrika
Posts: 1070
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: PiZero Ethernet pHAT

Sat Jan 16, 2016 1:20 pm

QLC+ is a multi-platform software and there is very little Raspberry specific code in it. Currently there is some Raspberry Pi interfaces in it and the SPI is created in a way that you need no interface chips between the Raspberry Pi and the RGB panels. The interface has only the clock and the MOSI pin. So I cannot do much about the SPI0.

User avatar
DougieLawson
Posts: 36098
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: PiZero Ethernet pHAT

Sat Jan 16, 2016 1:24 pm

karrika wrote:Obviously the soldering with very small chips is too hard so I may have to start shipping only completed Miscaps.
I asked a friend who repairs boards (from cattle milking systems) for his day job. He gave me two suggestions. 1. Use a horseshoe tip on a temp controlled iron or 2. Get leaded solder paste and cook the board in a hot domestic oven until done. He also said the name of the game is flux, lots of flux so the solder only flows onto the silvered pads.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
adun
Posts: 102
Joined: Fri Mar 20, 2015 9:25 am
Location: Switzerland

Re: PiZero Ethernet pHAT

Sat Jan 16, 2016 2:07 pm

karrika wrote:QLC+ is a multi-platform software and there is very little Raspberry specific code in it. Currently there is some Raspberry Pi interfaces in it and the SPI is created in a way that you need no interface chips between the Raspberry Pi and the RGB panels. The interface has only the clock and the MOSI pin. So I cannot do much about the SPI0.
I took a quick look at QLC+. As far as I understand the RGB panel is controlled by OLA running on the RPi So reffered to the OLA-RPi docs https://www.openlighting.org/ola/tutori ... ed-pixels/
Using the OLA SPI plugin each SPI interface (/dev/spi*) is represented as an OLA Device that can be used. On the RPi
if CE_0 is pulled low the /dev/spi0.0 device is used and if CE_1 is pulled low /dev/spi0.1 is used.
So this would allow to use spi0.0 and spi0.1 for light control and for expample spi0.2 for our enc28j60 module. (even if they don't use CE_0 for a single string)

User avatar
karrika
Posts: 1070
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: PiZero Ethernet pHAT

Sat Jan 16, 2016 2:39 pm

@DougieLawson

I have been working at an assembly line doing soldering for a living. So I forgot that all the tricks of the trade are not common knowledge. I should still have one soldered board without the pin-sockets. You will get it in the mail. Currently I am out of 40-pin connectors. I did order 100 more of them but for some reason the shipment was postponed till February.

@adun

The CE line helps if I add some latches on the board. But for the current DiscoCap I did not do it. During my tests there is actually no need for networks at all. The best way to program a light show on DiscoCap is to design it on Windows, Ubuntu or a Mac and write the show file directly to the home directory of the SD card. Then you can run it without display, kbd or mouse. Just use the push buttons.

Another good way is to put a mouse in the USB connector and a HDMI or analog display. In this case you need to create the show on Raspberry Pi.

Actually Miscap is not important at all. I can well live without it.

If you want to control the light shows from your mobile phone then the setup is PiZero + WiFi dongle + DiscoCap. No display, kbd or mouse is required.

So many options :?

User avatar
adun
Posts: 102
Joined: Fri Mar 20, 2015 9:25 am
Location: Switzerland

Re: PiZero Ethernet pHAT

Sat Jan 16, 2016 2:58 pm

ok thanks for the infos ;)

What I wanted to point out is that even if you don't use the CE_0 line the software can differ between the devices. If QLC+ uses SPI0.0 it will drive CE_0 low even if its not connected. And the enc28j60 module will only communicate if CE_2 is low.

SPI0.0 : Used by QLC+ (OLA) software (CE_0 not connected)

SPI0.1 : Can be used by OLA

SPI0.2 : Used for network (GPIO as CE_2)

So in combination with discocap, spi-ethernet and light control could share the SPI0 bus

That would simplify the procject and allow people to use other spi devices along with miscap. For example a SPI TFT
touchscreen etc.
Last edited by adun on Sat Jan 16, 2016 3:12 pm, edited 2 times in total.

User avatar
karrika
Posts: 1070
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: PiZero Ethernet pHAT

Sat Jan 16, 2016 3:06 pm

adun wrote: What I wanted to point out is that even if you don't use the CE_0 line the software can differ between the devices.
The software can see the difference. But the hardware can not. Unless you add chips to decode the chip select signals and add latches to separate the data bus. The LED's are not SPI devices. You can bit bang the LED's also. But QLC+ controls LED snakes and RGB panels directly without OLA. This is a brand new feature coded recently. The same is true for /dev/ttyAM0 support and GPIO pin I/O support.

Raspberry Pi is going to be one of the coolest computers for light and sound control.

Return to “HATs and other add-ons”