sandbox 0 Posted April 28, 2013 Share Posted April 28, 2013 Hi All, I am trying to use the MSP430G2553 on a TI -Launchpad to Communicate with a bunch of sensors, My problem is that i need to use I2C for one (eeprom) and SPI for another (display LCD). But according to the energia pin mapping here, the I2C pins and the SPI are on the same pins (p1_7 (UCB0SOMI) and p1_6 (UCB0SIMO)). How do i shift the MISO and MOSI pins to p1_1 and p1_2 , i know its supported by the G2553 hardware since the pins correspond to UCA0SOMI UCA0SIMO. Can someone please point me to the changes i need to make in the Energia core for this to happen? Please help... Thanks in advance, sandbox Quote Link to post Share on other sites
Rei Vilo 695 Posted April 28, 2013 Share Posted April 28, 2013 You can use software SPI as the functions are already built-in. See http://arduino.cc/en/Reference/ShiftOut for MOSI and http://arduino.cc/en/Reference/ShiftIn for MISO more information. sandbox 1 Quote Link to post Share on other sites
sandbox 0 Posted April 28, 2013 Author Share Posted April 28, 2013 I have looked into that, but this SPI lines needs to control an lcd display, so using software SPI might be too slow... Is there any reference on how fast this can go? Quote Link to post Share on other sites
lalalandrus 16 Posted July 12, 2013 Share Posted July 12, 2013 clock the hardware spi faster and use both on the same bus. the csn should be able to take care of it. bitbanged spi can be quite fast, but then you just have no time to process anything else.... i posted this in another thread recently of a bit banged spi (CPOL and CPHA = 0 ) uint8_t spi_send(const uint8_t _data) { const uint8_t MOSI = BIT7; const uint8_t MISO = BIT6; const uint8_t SCK = BIT5; uint8_t data = 0; if (_data & 0x80) P1OUT |= BIT7; else P1OUT &= BIT7; __delay_cycles(10); for (int i = 0 ; i < 8 ; i++) { if (_data & (1 << (7-i))) P1OUT |= BIT7; else P1OUT &= BIT7; data |= (P1IN & MISO) << (7-i); __delay_cycles( 4); P1OUT |= SCK; __delay_cycles( 8); P1OUT &= SCK; } return data; } spirilis 1 Quote Link to post Share on other sites
roadrunner84 466 Posted July 15, 2013 Share Posted July 15, 2013 You can ditch Energia and use plain C, or you can modify your SPI library (SPI.h/c) to use USCIA instead of USCIB. If you do the latter, try to use some switch parameter to not break SPI for all other applications, or better yet, split it off into a separate library or generic definition. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.