Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

Getting MSP430G2553 SPI library to support SPI on UCA0 channel?

$
0
0

The MSP430G2553 has the UCSI hardware chip that supports  UART, I2C and SPI.  According to the user guide and a tutorial I read over on the Argenox Technologies web site (quote):

 

The MSP430G2553 has two SPI interfaces, mapped with the following pins:

UCA0

  • P1.1 – UCA0SOMI
  • P1.2 – UCA0SIMO
  • P1.4 – UCA0CLK

UCB0

  • P1.6 – UCB0SOMI
  • P1.7 – UCB0SIMO
  • P1.5 – UCB0CLK

 

etc.  But I then notice that the pins_energia.h file hard codes it to use UCB0 only and seemingly provides no way to use the UCA0 channel at all.   Of course if I use UCA0 I understand it will clash with the TX/RX serial port pin such that  I will not be able to user the UART or the Serial package but that is fine for this application.  What I do want to do however is to user SPI on UCA0,  and simultaneously use I2C interface on pins P1.6 and P1.7 (and to not use SPI on those pins).

 

I am wondering why Energia did this and that there seemingly is no support for channel A of the UCSI, on the MSP430G2553, which does support two channels of SPI?

 

Would it be feasible in my program to just manually remap the pins right before including SPI.h header file?  For example if using the pfatfs library with it and using an SD card for logging on SPI channel 0, and use I2C sensor devices

 

#define MISO 3 // P1.1 UCA0SOMI
#define MOSI 4 // P1.2 UCA0SIMO
#define SCK  6 // P1.4 UCA0CLK
#define SS   7 // P1.4 chip select pin for slave
 
#include "SPI.h" 
#include "pfatfs.h"
 
void setup()
{
  FatFs.begin(cs_pin);   
 

... etc.

}

 

anyone tried this and does it seem feasible without having to rewrite standard Energia libraries. If need be I suppose I could just clone the entire SPI library and make it work with channel A0 instead of B0 but would rather avoid this.  Thanks in advance.


Viewing all articles
Browse latest Browse all 2077

Trending Articles