Jump to content

F5529, using alternate SPI and I2C interfaces

Recommended Posts

MSP430F5529 has two I2C interfaces, using P3.0/P3.1 (SDA/SCL) and P4.2/P4.1 (SCL/SDA) and two SPI interfaces using P3.0/P3.1/P3.2/P2.7 (MOSI/MISO/SCK/CS) and P4.2/P4.1/P4.3/P4.0 (MISO/MOSI/SCK/CS).


How, or rather maybe, what is the best way to access the non-default I2C/SPI peripherals, without resorting to modifying the Energia core?


For instance, I am using the LiquidCrystal_I2C library found here, and it works fine on the G2553 and F5529, but I'd like to move the LCD over to the other I2C peripheral so I can use those pins for an SPI device.


On Tiva, one can do "Wire.setModule(1)" or similar to do something with an alternative peripheral, but it seems this isn't possible with the F5529.


Might also be worth noting the above mentioned library doesn't play well on the LM4F/TM4C LaunchPads either. And FWIW, the LCD I'm using is a 20x4 with an I2C interface board labeled "Arduino-IIC-LCD GY-LCD-V1"

Link to post
Share on other sites

I don't think there is a simple elegant solution. An approach I can think of would be to pass or be able to pass the modules offset to your module object. So two different SPI objects will be talking to two different modules. This would require rewriting the software to use this new variable instead of how it is hardcoded now.


This opens up an issue with pin mapping. Because the pins that a module assigns to are device dependent. They could be mapped with some sort of pin structure.


This is something that should be addressed as people start using bigger and better MSP's the same approach should be used for all multiple instance hardware IMHO. Eg timers/DMA/ADC (do some MSPs have 2 ADC's?)

Link to post
Share on other sites

Using CCS type calls for the second interface might be the easiest, which isn't saying much. You'd be writing a second interface for it parallel to the Energia interface.

Best bet might be to modify Energia to use setModule on the lower grade MCUs and the submitting it to the github to see if it makes it in.

Bit of a pain in the rear.

Link to post
Share on other sites

There was a pull request on the Energia code that added what I'm talking about to the MSP430, in line with what the TM4C LP's have. It apparently didn't make it into the latest release though. I suppose that so long as my I2C devices have unique addresses, and I can find a way to divorce the I2C devices from SPI devices, I should be okay for the time being.


It shouldn't be that hard to put some logic in there so that when SPI is active, I2C devices are not connected to the SCK pin... or something like that.

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.

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...