Part Number:MSP430G2553
For weeks now, I have been trying to interface my MSP430G2553's with nRF24l01 transceivers. I followed the instructions of this forum exactly:
forum.43oh.com/.../
Unfortunately, I was not able to sign up for that forum (website issue) to ask questions, so here I am. The sample code given for the receiver seems to be working alright. I was able to measure the pin voltages and monitor the current draw of the receiver. However, the transmitter doesn't seem to be working as expected. The CE pin will not go high. Even if I force it high, the transmitter will not draw any current. Here's the code:
#include <SPI.h>
#include <Enrf24.h>
#include <nRF24L01.h>
#include <string.h>
Enrf24 radio(P2_0, P2_1, P2_2); // P2.0=CE, P2.1=CSN, P2.2=IRQ
const uint8_t txaddr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x01 };
const char *str_on = "ON";
const char *str_off = "OFF";
void dump_radio_status_to_serialport(uint8_t);
void setup() {
Serial.begin(9600);
SPI.begin();
SPI.setDataMode(SPI_MODE0);
SPI.setBitOrder(MSBFIRST);
radio.begin(); // Defaults 1Mbps, channel 0, max TX power
dump_radio_status_to_serialport(radio.radioState());
radio.setTXaddress((void*)txaddr);
//MY ADDITION TO THE CODE (FLASHING LED). THIS ENSURES THE MICROCONTROLLER IS READY/ACTIVE.
pinMode(P1_0, OUTPUT);
digitalWrite(P1_0, LOW);
int x=0;
volatile int state = HIGH;
volatile int flag = HIGH;
digitalWrite(P1_0, state);
while(x<15)
{
digitalWrite(P1_0, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a 1/10th second
digitalWrite(P1_0, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for 1/10th second
x=x+1;
}
//END FLASHING LED
}
void loop() {
Serial.print("Sending packet: ");
Serial.println(str_on);
radio.print(str_on);
radio.flush(); // Force transmit (don't wait for any more data)
dump_radio_status_to_serialport(radio.radioState()); // Should report IDLE
delay(1000);
Serial.print("Sending packet: ");
Serial.println(str_off);
radio.print(str_off);
radio.flush(); //
dump_radio_status_to_serialport(radio.radioState()); // Should report IDLE
delay(1000);
}
void dump_radio_status_to_serialport(uint8_t status)
{
Serial.print("Enrf24 radio transceiver status: ");
switch (status) {
case ENRF24_STATE_NOTPRESENT:
Serial.println("NO TRANSCEIVER PRESENT");
break;
case ENRF24_STATE_DEEPSLEEP:
Serial.println("DEEP SLEEP <1uA power consumption");
break;
case ENRF24_STATE_IDLE:
Serial.println("IDLE module powered up w/ oscillators running");
break;
case ENRF24_STATE_PTX:
Serial.println("Actively Transmitting");
break;
case ENRF24_STATE_PRX:
Serial.println("Receive Mode");
break;
default:
Serial.println("UNKNOWN STATUS CODE");
}
}
Other symptoms vary depending on if the IC is on the launchpad or standalone. On the launchpad, the CE and MISO pin remain at about half supply voltage. Standalone, they remain low. The most significant observation (only happens for standalone) is that the MOSI pin stays at 3.3V as expected, but pulses toward 0V every second or so repeatedly. During this short pulse duration, the transceiver tries to draw some current, but then shuts off immediately. The CE pin remains low for the most part. However, I was able to get a measurable voltage (in the mV range) during this odd pulse time.
Hardware setup remains the same between receiver and transmitter. If you want to see the working receiver code for comparison, I can post it as well. Any help here would be greatly appreciated.