hi ,i am working on P1021 RDB ,i want to configure I2c and SPI interface,and also want to test both interface device from bootloader.i am not sure about configure file to configure i2c and SPI interface.
Hello hiren patel,
I am not sure how would you like to test from boot loader. If you are using u-boot and Freescale SDK, the boot loader support I2C sub-system and SPI flash sub-system command:
Usage:
i2c bus [muxtype:muxaddr:muxchannel] - show I2C bus info
crc32 chip address[.0, .1, .2] count - compute CRC32 checksum
i2c dev [dev] - show or set current I2C bus
i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device
i2c md chip address[.0, .1, .2] [# of objects] - read from I2C device
i2c mm chip address[.0, .1, .2] - write to I2C device (auto-incrementing)
i2c mw chip address[.0, .1, .2] value [count] - write to I2C device (fill)
i2c nm chip address[.0, .1, .2] - write to I2C device (constant address)
i2c probe [address] - test for and show device(s) on the I2C bus
i2c read chip address[.0, .1, .2] length memaddress - read to memory
i2c write memaddress chip address[.0, .1, .2] length - write memory to i2c
i2c reset - re-init the I2C Controller
i2c speed [speed] - show or set I2C bus speed
Usage:
sf probe [[bus:]cs] [hz] [mode] - init flash device on given SPI bus and chip select
sf read addr offset len - read `len' bytes starting at `offset' to memory at `addr'
sf write addr offset len - write `len' bytes from memory at `addr' to flash at `offset'
sf erase offset [+]len - erase `len' bytes from `offset' `+len' round up `len' to block size
sf update addr offset len - erase and write `len' bytes from memory at `addr' to flash at `offset'
The drivers in u-boot:
\drivers\i2c\fsl_i2c.c
\drivers\spi\fsl_espi.c
Have a great day,
Lunmin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
hi lunminliang ,
Thanks for your reply.
i had already done this once i got u-boot prompt but i am looking for function to i2c_read()/ i2c_write() for testing the device while running the u-boot code,and same function to read and write SPI device.
With warm regardz,
Hiren
Hello hiren patel,
In \drivers\i2c\fsl_i2c.c, there are fsl_i2c_read() and fsl_i2c_write().
And in \drivers\spi\fsl_espi.c, there are fsl_espi_tx(), fsl_espi_rx() and spi_xfer().
Are those you are looking for? Are you trying to dynamically load and run "standalone" application in U-Boot, to test I2C and SPI?
Have a great day,
Lunmin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Lunminliang,
Thanks for your reply,
i am trying to load and run application in U-Boot for post test of SPI and I2C.
With warm regardz,
Hiren