OLED and ETHERNET problem

128x128 pixel 1.5" full colour OLED display with MicroSD card slot. [Product page]
tcornall
Posts: 3
Joined: Fri Oct 04, 2013 12:53 pm

OLED and ETHERNET problem

Post by tcornall » Fri Oct 04, 2013 1:09 pm

Hi.
I have the freetronics ethermega (which has on board Ethernet using SPI and uses d10 as SS pin) and I purchased the 128x128 OLED display, (which also uses SPI but has its own SS pin, D7, different from the Ethernet one) Great display, BTW.

The OLED works fine by itself, and the Ethernet works fine by itself (using Arduino FTOLED and Ethernet libraries and the examples) but when I use the oled.begin and Ethernet.begin in the same sketch, the Ethernet doesn't work. (The oled continues to work fine, as far as I can see)

I looked thru the library code and as far as I can tell, everything that uses the SS pin on the oled also releases it, and similarly for the Ethernet, so I can't see where the problem might be.

Here's the important bits of my code, with a comment about what happens if I call oled.begin before Ethernet.begin. (It fails too if I do them in the other order...)
Thanks in advance

#include <SPI.h>
#include <FTOLED.h>
#include <Ethernet.h>

const byte pin_cs = 7; //these are for the oled.
const byte pin_dc = 2;
const byte pin_reset = 3;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

IPAddress ip(192,168,0,6);
EthernetServer server(80);
OLED oled(pin_cs, pin_dc, pin_reset);

void setup()
{
Serial.begin(115200);
oled.begin(); //this interferes with the ethernet, which is a puzzle
Ethernet.begin(mac, ip); //this fails if oled.begin has been called previously, which is odd....
server.begin(); //because it works fine if I don't call oled.begin
Serial.print("server is at ");
Serial.println(Ethernet.localIP()); //I get 0.0.0.0 if oled.begin has been called
//and I get 192.168.0.6 if it hasn't, as requested.
.....other setup stuff...
}

Jed Hodson
Posts: 71
Joined: Wed Apr 24, 2013 5:14 am
Location: New South Wales, Australia

Re: OLED and ETHERNET problem

Post by Jed Hodson » Sun Oct 06, 2013 4:40 am

the problem may be due to them sharing the SPI a thread to look at may help viewtopic.php?f=37&t=5467

Jed

tcornall
Posts: 3
Joined: Fri Oct 04, 2013 12:53 pm

Re: OLED and ETHERNET problem

Post by tcornall » Sun Oct 06, 2013 6:51 am

Thanks for the suggestion Jed. I'll look into the code to see if I can see where the clocks get set. Maybe the method suggested in that thread, of switching clock rates depending on what device is being used, might work.

tcornall
Posts: 3
Joined: Fri Oct 04, 2013 12:53 pm

Re: OLED and ETHERNET problem

Post by tcornall » Sun Oct 06, 2013 8:38 am

Well, now this is weird! I think I've solved it....
I looked into OLED::begin and started commenting things out to see what was causing the problem, fully expecting to break the oled functionality. After trying clock divider and msbfirst v lsbfirst, I commented out this SPI_MODE3 setting and the Ethernet started working again. What is surprising is that the oled continues to work fine... So why was the data mode3 being set anyway? Beats me...

The following code is in FTOLED.cpp and the //TC is the line I've commented out.

void OLED::begin() {
SPI.begin();
SPI.setBitOrder(MSBFIRST);
//TC SPI.setDataMode(SPI_MODE3);
#ifdef __AVR__
SPI.setClockDivider(SPI_CLOCK_DIV2); // 8MHz on standard Arduino models
#else
SPI.setClockDivider(5); // 16.8MHz on Due
#endif
....more code

So, for now, this is solved. If anyone can explain why, that'd be nice...

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: OLED and ETHERNET problem

Post by angusgr » Tue Oct 08, 2013 4:49 am

tcornall wrote: I looked into OLED::begin and started commenting things out to see what was causing the problem, fully expecting to break the oled functionality. After trying clock divider and msbfirst v lsbfirst, I commented out this SPI_MODE3 setting and the Ethernet started working again. What is surprising is that the oled continues to work fine... So why was the data mode3 being set anyway? Beats me...
Glad to see you got it sorted.

The different SPI modes are documented a bit on the Arduino reference page and there's a bit more explanation on the SPI page.

The common point between Mode 3 and Mode 0 (the default), is that data is sampled on the rising edge. I remember testing that both of these worked on the display, and there was a minor reason I chose mode 3 (clock idles high), I think based on some small note in the OLED datasheet.

Probably the strangest thing is that the W5100 Ethernet chip used on the EtherMega officially supports either SPI mode 0 or mode 3 as well! I can't explain that. I also tested FTOLED with Ethernet, but I must have done the initialisation in some different way when I ran the test. I'll do some more testing soon, but it seems like changing FTOLED back to SPI mode 0 (default mode) is probably be the right option.

- Angus

Scargill
Posts: 8
Joined: Tue Apr 17, 2012 12:26 pm

Re: OLED and ETHERNET problem

Post by Scargill » Sat Feb 08, 2014 1:10 pm

This solved my problem - and I have another type of display with exactly the same issue I'm hoping to resolve thanks to this SUPERB little piece of information.... worth updating the library permanently??

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: OLED and ETHERNET problem

Post by angusgr » Sun Feb 09, 2014 11:18 pm

Hi scargill,

Thanks for reminding me about this one. I checked the OLED controller datasheet again and the timing diagrams do imply that the clock should idle high (ie mode 3), but I did some more tests and it really does seem to work fine in mode 0. Seems the controller really only really cares about the rising edge.

Library updated!

- Angus

yaoxuemei
Posts: 243
Joined: Fri Dec 15, 2017 7:34 am

Re: OLED and ETHERNET problem

Post by yaoxuemei » Thu Feb 01, 2018 1:31 am

yaoxuemei20180201coach outlet online
michael kors outlet
ugg boots clearance
oakley sunglasses
pandora rings
canada goose outlet store
canada goose outlet store
longchamp outlet
air max shoes
michael kors handbags sale
cheap nfl jerseys
michael kors official site
coach outlet online
moncler jackets
kate spade handbags
uggs outlet
cheap oakley sunglasses
lacoste shirts
pandora jewelry
mlb jerseys
kate spade handbags
coach outlet online
michael kors outlet
mont blanc
canada goose outlet online
mulberry outlet
uggs outlet online
nike outlet
uggs canada
polo shirts
canada goose
ralph lauren uk
polo ralph lauren outlet
cheap nfl jerseys
michael kors outlet stores
pandora outlet
nike shoes
polo ralph lauren outlet
cheap nfl jerseys
coach outlet
pandora outlet online
michael kors outlet
canada goose jackets
polo outlet
canada goose
ugg outlet online clearance
michael kors outlet
nike shoes outlet
ralph lauren pas cher
ugg outlet store
cheap uggs
nba jersey
michael kors outlet online
ugg boots clearance
pandora outlet
michael kors outlet
nfl jerseys wholesale
canada goose
pandora outlet store
michael kors outlet online
ugg outlet
uggs outlet
canada goose outlet
ugg outlet
ralph lauren sale
ugg outlet
ugg outlet
fitflop sale
nike outlet online
michael kors handbags
nike air max
michael kors outlet
valentino shoes
nike factory outlet
michael kors outlet
canada goose jackets
yeezy boost
polo outlet
canada goose
canada goose outlet store
michael kors outlet online
canada goose
uggs outlet
michael kors handbags
coach outlet clearance
ralph lauren polo
coach outlet store online
polo ralph lauren outlet
ugg boots outlet
ray ban sunglasse
polo ralph lauren
asics outlet
oakley sunglasses wholesale
ugg boots clearance
tory burch shoes
mcm outlet
uggs outlet
ugg canada
nike outlet
michael kors outlet online
ugg boots clearance
canada goose jackets
hermes birkin
oakley sunglasses
canada goose jackets
uggs outlet
canada goose jackets
coach factory outlet
ralph lauren uk
polo ralph lauren
canada goose outlet
michael kors outlet clearance
ralph lauren shirts
cheap ray ban sunglasses
canada goose jackets
christian louboutin outlet
ugg boots
fred perry clothing
ugg boots clearance
mont blanc pens
cheap ugg boots
michael kors outlet
adidas yeezy
canada goose outlet stores
michael kors outlet online
coach outlet store online
pandora charms outlet
coach canada
canada goose jackets
coach outlet store online
michael kors outlet
polo ralph lauren outlet online
christian louboutin outlet
true religion jeans
coach outlet online
canada goose outlet store
polo ralph lauren factory store
uggs outlet online
adidas yeezy shoes
ugg outlet
polo ralph lauren
coach outlet
coach outlet
canada goose outlet store
ugg boots clearance
pandora charms
canada goose outlet
pandora jewelry
adidas shoes
cheap ray ban
longchamp outlet
cheap oakley sunglasses
nike outlet
ralph lauren
adidas nmd r2
air jordan 4
pandora outlet
pandora bracelet
canada goose outlet
coach outlet
michael kors outlet
ed hardy
ugg boots clearance
oakley sunglasses wholesale
mulberry bags
ugg outlet online
coach outlet
mulberry handbags
canada goose outlet
fred perry clothing
puma outlet
uggs outlet
moncler coats
coach outlet online
kate spade outlet
prada outlet online
canada goose outlet store
christian louboutin outlet
ugg outlet
fitflops sale
canada goose outlet store
canada goose
tory burch sandals
coach factory outlet
canada goose
ray ban sunglasses
adidas yeezy boost
uggs outlet
michael kors outlet online store
oakley sunglasses wholesale
pandora outlet online
pandora jewelry
michael kors outlet
ralph lauren outlet
michael kors outlet clearance
michael kors outlet
polo ralph lauren outlet
ugg boots clearance
cheap ugg boots

clibin009
Posts: 563
Joined: Mon Oct 23, 2017 2:57 am

Re: http://bodyprohealth.com/dermaclear/

Post by clibin009 » Fri Feb 02, 2018 1:40 am

ugg pas cher
asics
adidas jeremy scott
air max 2018
moncler
north face jackets
ferragamo shoes
swarovski jewelry
louboutin
yeezy shoes
michael kors
kevin durant shoes
ugg outlet
pandora jewelry
adidas superstar
moncler pas cher
ugg outlet
polo outlet
red bottom shoes
the north face
longchamp outlet
nba jerseys
balenciaga shoes
hermes birkin bags
coach outlet online
snapbacks wholesale
hermes uk
fitflops outlet
adidas slides
burberry outlet online
adidas shoes
michael kors outlet
nike blazer
coach outlet
hermes outlet
nike roshe
ugg canada
nike air max
ray ban sunglasses
canada goose outlet
coach outlet
cheap oakley sunglasses
salvatore ferragamo
nike free
nike tn
moncler jackets
uggs outlet
oakley sunglasses
ugg outlet store
canada goose
uggs outlet
air huarache
curry shoes
barcelona jersey
hermes
jordans
supra shoes
true religion jeans
uggs
canada goose outlet
van cleef & arpels jewelry
nike factory outlet
uggs outlet
canada goose jackets
pandora charms
michael kors
moncler
ugg boots
moncler
burberry outlet
nfl jerseys
nike shox
flops
oakley sunglasses
air force 1
kate spade
air jordan 14
tommy hilfiger
ugg
jordan pas cher
givenchy handbags
coach factory outlet
longchamp handbags
jordan shoes
supreme uk
jordan 4
harden vol 1
adidas stan smith shoes
oakley canada
wholesale nfl jerseys
tory burch outlet
air max
air max
coach factory outlet online
coach factory outlet
longchamp
mont blanc pens
michael kors outlet
kobe 11
ray ban sunglasses
stan smith shoes
supreme outlet
air jordan
ray ban sunglasses
ray ban
links of london
belstaff jackets
polo ralph lauren outlet
jordan shoes
burberry outlet
michael kors outlet
tory burch
michael kors outlet
uggs
cheap ugg boots
superdry clothing
cheap mlb jerseys
timberland pro
fitflops
ralph lauren
swarovski
adidas shoes
north face jackets clearance
ugg boots on sale
flip flops
moncler outlet
hermes kelly bag
timberland boots
blackhawks jersey
ugg
mont blanc
coach outlet online
air jordan
lebron 15
polo ralph lauren
coach outlet online
ugg boots sale
ralph lauren uk
polo ralph lauren
moncler outlet
converse shoes
oakley sunglasses
fingerlings monkey
north face
mulberry handbags
cheap nhl jerseys
manolo blahnik shoes
canada goose jackets
true religion jeans
north face outlet
the north face
pandora jewelry canada
jordan 8
jordans
adidas uk
ralph lauren uk
polo ralph
true religion jeans
miu miu shoes
air max 1
the north face
ralph lauren
jordan xx9
ray ban
nike dunks
ralph lauren
jordan
soccer jerseys
coach handbags
jimmy choo shoes
jordan retro
true religion jeans
ray ban
ugg boots
coach factory online
nike tennis
flip-flops
doudoune canada goose
canada goose down jacket
michael kors taschen
kate spade
north face
louboutin
adidas outlet store
louboutin
air max 2017
flip flops
ugg boots
coach factory outlet online
oakley sunglasses
adidas yeezy
mbt shoes
nike kyrie 3
cheap nfl jerseys
michael kors handbags
canada goose jackets
timberland boots
giuseppe zanotti shoes
oakley sunglasses
jordan 1
cheap nfl jerseys
longchamp
air jordan 11
cheap rolex watches
ugg
ugg clearance
new balance
oakley sunglasses wholesale
michael kors outlet
ugg boots
uggs outlet
balance shoes
tod's shoes
nike store uk
michael kors outlet
ugg canada
jordans
ugg
michaelkors outlet online
cheap jordans
mac cosmetics
coach handbags
ray ban
ugg boots
swarovski crystal
red bottoms
cheap jerseys
undefeated shoes
burberry outlet canada
true religion
ugg australia
ugg boots
north face
air max 95
ugg italia
prada
ralph lauren
coach outlet online
bvlgari rings
cheap ray bans
ugg boots
michael kors outlet online
basketball shoes
moncler jackets
nike outlet
true religion jeans
converse
marc jacobs
adidas wings
stuart weitzman shoes
mont blanc pens
louboutin
ugg outlet
nike huarache shoes
ralph lauren
pandora
cheap nfl jerseys
north face
herve leger dresses
ray ban sunglasses
polo ralph
ugg boots
coach outlet online
air max plus
nike outlet
ray ban sunglasses
light up shoes
north face outlet
canada goose
michael kors handbags
air max
ray ban
scarpe mbt
asics running shoes
adidas football boots
longchamp outlet
nike outlet
supreme
air max 97
coach outlet online
dolce and gabbana
christian louboutin
roshe run
nike air
polo ralph lauren
carnival shoes
beats by dre
adidas yeezy 350
oakley vault
canada goose sale
pandora jewelry
polo shirts
stussy hoodie
pandora uk
replica watches
coach outlet
alexander mcqueen shoes
under armour outlet
canada goose outlet
ugg
jordan 5
timberland boots
nhl jerseys
vibram five fingers
north face jackets
nike air max
air jordan
birkenstock sandals
juicy couture outlet
jordans
nike sb
louboutin
bcbg
michael kors outlet
nike outlet store
converse shoes
ugg boots
michael kors outlet clearance
jordan shoes
uggs outlet
nike football boots
moncler schweiz
prada
doudoune canada goose
jordan 12
nike lunarglide
nike mercurial vapor
kate spade
jordan 6
pandora jewelry
cheap ugg boots
cheap mlb jerseys
air max
nike free run
north face
ugg outlet
nike uk
coach factory outlet
cartier jewelry
michael kors handbags
wedding shoes
tory burch
christian louboutin
moncler
coach outlet online
oakley sunglasses
uggs outlet
supreme
canada goose outlet
asics running shoes
moncler
oakley sunglasses
moncler
baseball jerseys
ugg outlet store
manchester united jersey
nike revolution
canada goose jackets
ugg outlet
tory burch outlet
coach outlet
air max 90
canada goose jackets
ugg boots
dior handbags
louboutin
nike presto
adidas flip flops
polo ralph
nike shoes
birkenstock
coach outlet
michael kors uk
louboutin
canada goose
north face outlet
timberland outlet
ferragamo outlet
coach
ugg boots
coach
canada goose
nike blazer
pandora jewelry canada
mlb jerseys
the north face
michael kors outlet
valentino shoes
ray ban
michael kors outlet
jordan shoes
coach factory outlet
moncler outlet
north face uk
ralph lauren
moncler
longchamp
pandora outlet
north face
canada goose canada
mcm bags
louboutin
prada bags
nike cortez
jordan
nike air max
ralph lauren outlet
mishka clothing
nfl jerseys wholesale
north face uk
flops
kate spade handbags
louboutin
nike flip-flops
nike factory outlet
kate spade outlet
prada handbags
ugg boots
canada goose coats
nike air force
birkenstock outlet
bottega veneta
kate spade
jordan 3
ugg boots
baseball bats
burberry scarf
canada goose outlet
jordan shoes
ugg outlet store
mizuno running shoes
ray ban sunglasses wholesale
adidas outlet
nike free run
dansko shoes
nike free
ralph lauren uk
air max 270
moncler
michael kors handbags
pandora charms
nike air huarache
michael kors outlet
20182.2chenjinyan

yaoxuemei
Posts: 243
Joined: Fri Dec 15, 2017 7:34 am

Re: OLED and ETHERNET problem

Post by yaoxuemei » Fri Feb 02, 2018 9:39 am

yaoxuemei20180202michael kors outlet clearance
christian louboutin shoes
michael kors outlet
coach outlet
cheap mlb jerseys
michael kors outlet
coach outlet store
mcm bag
ugg outlet stores
coach outlet
mulberry sale
puma shoes
ugg boots outlet
ugg outlet
michael kors outlet
canada goose jackets
adidas shoes for men
coach outlet online
michael kors outlet
michael kors outlet
tory burch outlet stores
coach outlet
true religion jeans
cheap jordans
nike outlet
michael kors outlet
oakley sunglasses
christian louboutin shoes
michael kors outlet
tory burch outlet
polo ralph lauren factory store
oakley sunglasses
michael kors outlet
fred perry polo
michael kors handbags
cheap nfl jerseys
cheap nfl jerseys
oakley sunglasses outlet
michael kors outlet clearance
oakley sunglasses
coach outlet clearance
fitflops sale clearance
canada goose
fred perry clothing
cheap jordan shoes
lacoste shoes
cheap authentic nba jerseys
nike air max
coach factory outlet
ugg boots
canada goose outlet store
longchamp handbags
polo ralph lauren
coach outlet
ray ban sunglasses
cheap nfl jerseys
cheap ugg boots
ralph lauren uk
pandora outlet
fred perry polo shirts
michael kors outlet online
jordan retro
nike shoes outlet
michael kors outlet clearance
ed hardy
coach outlet store online
air max 2017
oakley sunglasses wholesale
michael kors outlet
michael kors outlet
ralph lauren pas cher
adidas yeezy shoes
polo ralph lauren outlet
uggs outlet
canada goose jackets
michael kors outlet
ralph lauren outlet
cheap ugg boots
ugg outlet
michael kors outlet
coach outlet online store
ugg outlet online
mbt shoes clearance outlet
canada goose jackets
kate spade outlet
canada goose outlet
adidas ultra boost
ugg outlet online clearance
uggs outlet
michael kors outlet
coach outlet online
ugg outlet store
coach outlet
uggs outlet
coach outlet store online
michael kors outlet
canada goose
fitflops shoes
canada goose jackets canada
asics outlet
pandora jewelry
ugg outlet online
ugg outlet
ugg boots clearance
polo outlet
kate spade handbags
ugg outlet
cheap ray ban sunglasses
polo ralph lauren
fred perry outlet
kate spade handbags
kate spade outlet
uggs outlet
ray ban sunglasses
coach factory outlet
ray ban sunglasse
ugg outlet
ugg boots clearance
coach outlet online
ugg outlet
mont blanc outlet
coach outlet
canada goose jackets
nike shoes on sale
ugg outlet
fitflops sale
michael kors outlet
polo outlet
polo outlet
pandora outlet
mbt shoes
tory burch handbags
canada goose
canada goose jackets
pandora charms
ralph lauren uk
polo outlet
fred perry polo shirts
pandora outlet
ugg boots
ugg boots on sale
ugg outlet
michael kors outlet online
ray ban outlet
cheap nba jersey
michael kors outlet clearance
coach outlet store online
ugg outlet store
ugg outlet
ugg outlet
michael kors outlet clearance
ed hardy outlet
polo outlet
pandora jewelry outlet
ray ban sunglasses
ralph lauren
pandora bracelet
ralph lauren shirts
kate spade bags
mont blanc outlet
true religion outlet store
nike air jordan 4
pandora jewelry
ralph lauren outlet
ugg boots clearance
coach outlet
polo outlet
adidas nmd shoes
yeezy boost
coach outlet online
coach factory outlet online
cheap ugg boots
michael kors outlet online
nfl jerseys wholesale
michael kors handbags
pandora charms
pandora jewelry
pandora outlet
nike outlet
ray-ban sunglasses
nike shoes
canada goose jackets
canada goose
coach outlet
christian louboutin shoes
canada goose
uggs outlet
cheap oakley sunglasses
polo ralph lauren sale
nike outlet store
uggs outlet
polo shirts
adidas yeezy shoes
coach factory outlet
ray ban sunglasse
nike shoes
uggs canada
nfl jerseys
michael kors outlet online
oakley sunglasses wholesale

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests