EmbeddedRelated.com
Forums

SiLab C8051F064, SPI, 3/4 wire, P0.3, NSSMD problem

Started by Bill Davy November 27, 2009
SiLab C8051F064, SPI, 3/4 wire, P0.3, NSSMD problem:



========================================



Commissioning new board which has used P0.3 for a chip select for an SPI 
device (MAX3420 being USB target).The 8051 is the SPI master.  In the past 
we used P3.7 for chip select (with SPI in three wire mode) and all worked 
well.



First approach was to use P0.3 as a GPIO pin.  Wanted to do this as we had 
previously used 3-wire SPI without any problem.



With the following setting, P0.3 does not change:



P0MDOUT = 0x0D



SPIOCN = 0x03 meaning NSSMD = 00b so three wire SPI, leaving P0.3 as a GPIO 
pin.



XBR0 = 0x02



XBR1 = 0x31



XBR2 = 0x40 (set last, so XBARE=1 is final part of set-up)



XBR3 = 0x08



Setting and clearing P0.3 has no effect on the output pin (confirmed with a 
�scope).



The SPI is set up before enabling the cross bar because that was recommended 
(though cannot find the reference now) and as I say, it has and does work 
well like that.







Second approach was to use 4-wire SPI (NSSMD1=1) and use NSSMD0 to wiggle 
the wire that was P0.3 and hooray, the wire does wiggle (proving it is 
soldered up right).  But now we have another problem.  It is a bit hard to 
explain, but the MISO line which should be coming from the MAX3420 sometimes 
seems to be being pulled down so the 8051 does not reliably see 1's.  This 
can happen while the byte is being shifted out, and even with all interrupts 
disabled and the processor just waiting for the shift register to empty.







If we use a wire link from P3.7 to CS everything works fine which suggests 
the wiring and software is hunky dory (USB connects, etc).







Desperate to use P0.3 as there are 18 boards made up :-(



TIA,

   Bill Davy


In article <7n9ugmF3knomoU1@mid.individual.net>,=20
Bill@SynectixLtd.com says...
> SiLab C8051F064, SPI, 3/4 wire, P0.3, NSSMD problem: >=20 > Commissioning new board which has used P0.3 for a chip select for an SPI=
=20
> device (MAX3420 being USB target).The 8051 is the SPI master. In the pas=
t=20
> we used P3.7 for chip select (with SPI in three wire mode) and all worked=
=20
> well. >=20 > First approach was to use P0.3 as a GPIO pin. Wanted to do this as we ha=
d=20
> previously used 3-wire SPI without any problem. >=20 > With the following setting, P0.3 does not change: >=20 > P0MDOUT =3D 0x0D
> SPIOCN =3D 0x03 meaning NSSMD =3D 00b so three wire SPI, leaving P0.3 as =
a GPIO=20
> pin.
> XBR0 =3D 0x02 >=20 > XBR1 =3D 0x31 >=20 > XBR2 =3D 0x40 (set last, so XBARE=3D1 is final part of set-up) >=20 > XBR3 =3D 0x08 >=20 > Setting and clearing P0.3 has no effect on the output pin (confirmed with=
a=20
> ?scope).
I would check your crossbar configuration again; I think you=20 might have P0.3 configured as MISO. =20
> The SPI is set up before enabling the cross bar because that was recommen=
ded=20
> (though cannot find the reference now) and as I say, it has and does work=
=20
> well like that. >=20 > Second approach was to use 4-wire SPI (NSSMD1=3D1) and use NSSMD0 to wigg=
le=20
> the wire that was P0.3 and hooray, the wire does wiggle (proving it is=20 > soldered up right). But now we have another problem. It is a bit hard t=
o=20
> explain, but the MISO line which should be coming from the MAX3420 someti=
mes=20
> seems to be being pulled down so the 8051 does not reliably see 1's. Thi=
s=20
> can happen while the byte is being shifted out, and even with all interru=
pts=20
> disabled and the processor just waiting for the shift register to empty.
MISO is likely configured as open-drain. Are you relying only on=20 the weak internal pullup? Try something stiffer.
>=20 > If we use a wire link from P3.7 to CS everything works fine which suggest=
s=20
> the wiring and software is hunky dory (USB connects, etc). >=20 >=20 > Desperate to use P0.3 as there are 18 boards made up :-( >=20 >=20 >=20 > TIA, >=20 > Bill Davy
"Gene S. Berkowitz" <first.last@verizon.net> wrote in message 
news:MPG.2579ed48b3e14df6989683@news.giganews.com...
In article <7n9ugmF3knomoU1@mid.individual.net>,
Bill@SynectixLtd.com says...
> SiLab C8051F064, SPI, 3/4 wire, P0.3, NSSMD problem: > > Commissioning new board which has used P0.3 for a chip select for an SPI > device (MAX3420 being USB target).The 8051 is the SPI master. In the past > we used P3.7 for chip select (with SPI in three wire mode) and all worked > well. > > First approach was to use P0.3 as a GPIO pin. Wanted to do this as we had > previously used 3-wire SPI without any problem. > > With the following setting, P0.3 does not change: > > P0MDOUT = 0x0D
> SPIOCN = 0x03 meaning NSSMD = 00b so three wire SPI, leaving P0.3 as a > GPIO > pin.
> XBR0 = 0x02 > > XBR1 = 0x31 > > XBR2 = 0x40 (set last, so XBARE=1 is final part of set-up) > > XBR3 = 0x08 > > Setting and clearing P0.3 has no effect on the output pin (confirmed with > a > ?scope).
I would check your crossbar configuration again; I think you might have P0.3 configured as MISO. SPIOCN = 0x03 meaning NSSMD = 00b so three wire SPI XBR0 = 0x02 (SPIOEN) XBR1 = 0x31 (CP1E, INT1E, T2E) XBR2 = 0x40 (set last, so XBARE=1 is final part of set-up) XBR3 = 0x08 (CP2E) So I would expect to see: P0.0 = SCK P0.1 = MISO P0.2 = MOSI P0.3 = CP1 P0.4 = CP2 P0.5 = INT1 P0.6 = T2
> The SPI is set up before enabling the cross bar because that was > recommended > (though cannot find the reference now) and as I say, it has and does work > well like that. > > Second approach was to use 4-wire SPI (NSSMD1=1) and use NSSMD0 to wiggle > the wire that was P0.3 and hooray, the wire does wiggle (proving it is > soldered up right). But now we have another problem. It is a bit hard to > explain, but the MISO line which should be coming from the MAX3420 > sometimes > seems to be being pulled down so the 8051 does not reliably see 1's. This > can happen while the byte is being shifted out, and even with all > interrupts > disabled and the processor just waiting for the shift register to empty.
MISO is likely configured as open-drain. Are you relying only on the weak internal pullup? Try something stiffer. OK, I will look into that.
> > If we use a wire link from P3.7 to CS everything works fine which suggests > the wiring and software is hunky dory (USB connects, etc). > > > Desperate to use P0.3 as there are 18 boards made up :-( > > > > TIA, > > Bill Davy
Bill PS Sorry, do not see how to make Outlook Express include original message shifted over.