Jump to content
43oh

Use of two (or more) SPI ports at once


Recommended Posts

Hi!

 

First of all, thank you for creating this great project. I am thinking about switching to Arduino/Energia from mbed (and Arduino before).

However, I have a question: My project requires communicating with at least two SPI devices at once (read data from a sensor, put data into a circular buffer, write it then on SD-Card). It is not possible to use a single SPI with different CS-lines. 

 

How would the code look for this? In this forum, I found "SPI.setModule(0)", but in Arduino, I have only a single SPI object...

 

Thank you for any hint in advance,

Tobias

Link to post
Share on other sites

Except for the MSP430G2955 or MSP430F... the usual launchpad chips do not support more than one SPI port at once. This limitation can be overcome by using software SPI, I guess there are people who made a library for this, since SPI isn't that complicated at all.

If you fail to find one, I can write one up for you if required, though I'd like to know how timing etc. should be handled in this case.

Link to post
Share on other sites

Hi, thank you for the suggestions and the quick response!

 

I plan to use the Stellaris LaunchPad Evaluation board (EK-LM4F120XL) which carries the Stellaris LM4F120H5QR.

According to the pinout map of the board and to the Datasheet of the MCU it has four SPI ports.

Unfortunately, my application really requires two independent SPI ports. I managed to et this up with the mbed (NXP Arm Cortex M3 processor, higher price, two SPI) without issues. Therefore I am shure that it will work with the TI chip as well.

 

But my big question now is: How would it work? Can I do it with the Arduino/Energia SPI-Class, or will I need to copy&rename the SPI-class, e.g. SPI2, and assign pins of another hardware SPI port?

Again, my question relates to use of Energia IDE.

 

Thank you everybody for suggestions,

 

Tobias

 

Edit: Working synchroneus is not necessary

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...