element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
Software Application Development Maxim Analog Essentials PMOD devices under Linux
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Avnet Boards Forums to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 1 reply
  • Subscribers 328 subscribers
  • Views 306 views
  • Users 0 members are here
Related

Maxim Analog Essentials PMOD devices under Linux

peter.archer@earthlink.net
peter.archer@earthlink.net over 12 years ago

I have managed to get the SPI capable devices from this collection working with the Zedboard under the Xilinx Linux distribution.Specifically what I did was:

1.  Include the Xilinx AXI_Lite SPI IP Core with 5 slave selects, a 100 Mhz clock with a clock devisor of 8, giving a SPI clock of 12.5 Mhz.  SS (Slave Select) 0 is connected to JA1, MOSI to JA2, MISO to JA3, and SCK to JA4.  This is consistent with the Maxim PMOD standard.  I connected SS 1-4 to JA 7-10 (the other 4 slave select lines).

2.  I downloaded and installed Xilinx's device tree generator to the SDK and used to generate a device tree file that I used as a template to edit the new SPI interface into the Zedboard device tree.

3. I added additional devices under the SPI interface tree for the 5 slave selects I configured

4.  I turned on the Xilinx SPI and SPIDEV in the xilinx_zynq_defconfig to get driver support and generated linux-xlnx.

5.  Spent a lot of time debugging xilinx_spi driver (first a bad bitstream generation caused kernel bus errors (406) during driver initialization) and then failure to launch (xilinx_spi drover defaulting to Big endian when ARM is little endian).

6.  Added a new property to SPI interface device tree entry to enable specification of endian selection in the driver, and added code to get and use property in driver during initialization with default being little rather than big endian.

7.  Wrote a test Linux application to exercise MAX31855 (temperature sensor) via the SPIDEV protocol driver using its standard IOCTL and Read interfaces (Device doesn't do write, MOSI not connected)

8.  At least one of the other Maxim PMODs uses a high slave select signal, which is the inverse of the SPI standard of slave select active low.  This PMOD is unusable under Linux as the driver only supports an active low slave select.  I plan on making an adapter board, with a 12 pin PMOD cable connector for connection the JA/1 PMOD connector on the Zedboard and with 5 6 pin sockets for SPI devices, numbered SPIDEV0-4, and with the 5 slave selects from the Zedboard routed to Pin 1 of each socket.  This will allow the use of up to 5 SPI devices off of a single PMOD port on the Zedboard.  I will also put in inverters on the slave selects, each configurable by jumper, to optionally invert individual slave selects and this will overcome the high slave select issue.

9.  The other problem is the clock rate is fixed in the IP core.  The only way of changing it is to change the PL (new bitstream, boot.bin and device tree entry) and of course it then applies to all SPI devices on the interface.  Best is to pick a speed that is suitable for the slowest SPI device that will be used.

The system works very well. Linux maintains an input queue of SPI transfer requests between the protocol driver (SPIDEV) and the SPI interface controller (XILINX_SPI) ensuring each operation is atomic and so they don't interfere with each other.  Slave select is dropped after each operation, so to perform write/read operations without dropping slave select (required by some SPI devices) you have to use SPIDEV ioctrl's message transfer method rather than simple write/reads.  But it works very well.  I've tested with multiple end user applications running simultaneously on the same device and on multiple devices without problems.

Very little of this is documented anywhere, so finding and fixing these problems was challenging.  Anyone embarking on the same endeavor with the Zedboard may want to contact me.

Peter


  • Sign in to reply
  • Cancel
  • Former Member
    0 Former Member over 10 years ago

    I am having similar issues...
    sigh.

    can you expand on your post above?  I think useful stuff would be the config changes you made and your updated device tree.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube