I’m now trying to connect MSP430FR2355 with RFM95 LoRa module(https://www.adafruit.com/product/3072?gclid=EAIaIQobChMIz-XBxZba4AIVSLjACh1DTg8GEAQYAiABEgKZw_D_BwE).
First I put all pins in MSP into OUTPUT LOW. And I test the current can be 1 uA. That’s really great.
I use SPI to put RF95 into sleep mode. But when connect the MSP with RFM95, the total current is about 583 uA. I also put DMM between the 3V3(MSP) and Vin(RF), the current is 563 uA. Besides, the current is 530 uA when I put DMM between GND(RF) and GND(MSP). According to RF95 datasheet, the current can be 0.2uA in sleep mode. So the current I got is too large.
When in the test, I find that the MSP pins are about -0.3V to 0.3V(OUTPUT LOW). Does this cause some leakage current when connecting to RF chip? I also try to connect RF chip’s DIO pin to either 3V3 or GND, but the current is almost the same. Is there any way to configure the RF95 pins into INPUT HIGH. Are there other reasons that cause this high current?
I’m now out of ideas. If anyone can help me, I’m so grateful.
#include <msp430.h>
#include <stdint.h>
#include <RH_RF95.h>
void rfi (void);
void ls1 (void);
void tb (int tm);
void si (void);
unsigned char sa (unsigned char); uint8_t data;
void csn_high (void);
void csn_low (void);
void ce_high (void);
void ce_low (void);
void sw (uint8_t, uint8_t); uint8_t val;
int main(void)
{
WDTCTL = WDTPW | WDTHOLD;
//CSCTL4 = SELA__VLOCLK | SELMS__VLOCLK;
ls1();
si();
rfi();
ls1();
tb(1000);
__bis_SR_register(LPM3_bits | GIE);
}
#pragma vector = TIMER0_B0_VECTOR
__interrupt void Timer_B (void)
{
}
void rfi (void)
{
ce_high();
sw(RH_RF95_REG_01_OP_MODE, RH_RF95_MODE_SLEEP);
ce_low();
csn_low();
}
void ls1 (void)
{
P1DIR = 0xff; P2DIR = 0xff;
P3DIR = 0xff; P4DIR = 0xff;
P5DIR = 0xff; P6DIR = 0xff;
P1OUT = 0x00; P2OUT = 0x00;
P3OUT = 0x00; P4OUT = 0x00;
P5OUT = 0x00; P6OUT = 0x00;
}
void tb (int tm)
{
TB0CTL = TBSSEL__ACLK | MC__UP;
TB0CCR0 = tm;
TB0CCTL0 |= CCIE;
}
void si (void)
{
P1DIR |= BIT4; P1OUT |= BIT4;
P1DIR |= BIT3;
P1SEL0 |= BIT5; P1DIR |= BIT5;
P1SEL0 |= BIT7; P1DIR |= BIT7;
P1SEL0 |= BIT6; P1DIR &= ~BIT6;
P2DIR |= BIT0;
UCA0CTLW0 |= UCSWRST;
UCA0MCTLW = 0x00;
UCA0CTLW0 |= UCMST|UCSYNC|UCCKPH|UCMSB|UCMODE_0;
UCA0CTLW0 |= UCSSEL__SMCLK;
UCA0BR0 |= 0x01;
UCA0BR1 |= 0x00;
UCA0CTLW0 &= ~UCSWRST;
}
unsigned char sa (unsigned char data)
{
UCA0TXBUF = data;
while ( !(UCA0IFG & USCI_SPI_UCRXIFG) );
return UCA0RXBUF;
}
void csn_high (void)
{
P1OUT |= BIT4;
}
void csn_low (void)
{
P1OUT &= ~BIT4;
}
void ce_high (void)
{
P1OUT |= BIT3;
}
void ce_low (void)
{
P1OUT &= ~BIT3;
}
void sw (uint8_t addr, uint8_t val)
{
csn_low ();
sa (addr | 0x80);
sa (val);
csn_high ();
}