[U-Boot] Soft_spi questions

laurent vaudoit laurent.vaudoit at gmail.com
Tue May 28 16:57:22 CEST 2013


Hi,
thanks for your answer.


On Tue, May 28, 2013 at 4:41 PM, Jagan Teki <jagannadh.teki at gmail.com>wrote:

> HI,
>
> Few little comments.
> CCed driver contributed delegate, may be they will help if I am
> missing any thing.
>
> On Tue, May 28, 2013 at 6:48 PM, laurent vaudoit
> <laurent.vaudoit at gmail.com> wrote:
> > Hello all,
> >
> > i have integrated soft_spi driver in u-boot, in order to communicate
> with a
> > FRAM device, using some GPIO.
> >
> > I use mode 0 of spi (CPHA=0, CPOL=0).
> >
> > When i try to communicate with the device, i have a problem, none of my
> > commands are answered.
>
> Giving to an understnding how does it works, ignore if you know it already.
>
> usually we have give an mode bit as 0, so the mode bit will check at
> driver level to get any change on
> clock phase and polarity level(CPHA and CPOL)
>
> u-boot> sf probe 0 0 0
> last argument assigns the global mode variable.
>
> You checked with mode 0 or 1?
>
> What exactly the issue log, means where it goes wrong?
> Does it on spi_xfer?, or spi_claim_bus?
>
> My problem is on sspi_xfer function
for testing i use command
sspi 0 (chip select) size data

i have ss->mode to 0 (so CPHA and CPOL is 0)

When i look at the code, i have:
if (!cpha)
SPI_SCL(!cpol);          My problem is this line
SPI_SDA(tmpdout & 0x80);
SPI_DELAY;
if (cpha)
SPI_SCL(!cpol);
else
SPI_SCL(cpol);
tmpdin <<= 1;
tmpdin |= SPI_READ;
tmpdout <<= 1;
SPI_DELAY;
if (cpha)
SPI_SCL(cpol);




> >
> > After looking signals with scope, i see that if CPHA and CPOL are 0,
> > there is a rising edge on the clock signal, before data is set on mosi
> > signal.
> >
> > So the device get a first byte in an "unknown state".
> >
> > looking at the code, we can see that if CPHA is 0, we put a rising edge
> on
> > clock before any data management.
> >
> > I made work the communication by forcing CPHA to 1 but i think it is not
> > good way.
>
> What you made by default the CPHA is 0x1, did you make change on the
> spi_xfer?
>

yes for testing, i force local variable cpha to 1 in spi_xfer.

I hope i'm clear,

thanks

Laurent

>
>
> Thanks,
> Jagan.
>
> >
> > Is there something i don't understand?
> >
> > thank you  in advance for your answer.
> >
> > Regards
> >
> > Laurent Vaudoit
> >
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot at lists.denx.de
> > http://lists.denx.de/mailman/listinfo/u-boot
>


More information about the U-Boot mailing list