Jump to content
43oh

Recommended Posts

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

 

 

Link to post
Share on other sites
  • 2 months later...

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; 
}
Link to post
Share on other sites

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.

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