【发布时间】:2021-03-24 20:47:47
【问题描述】:
我的系统有问题,我无法处理。问题是; 当我在没有调试的情况下用直流电压(3.3 v)为系统供电时,我在接收器端看不到任何东西(Arduino Uno 作为接收器)。但是,如果我使用调试器[FET430 - UIF],那么我可以看到接收器端的所有字符。
这是我的代码:
#include <msp430.h>
#include "cc430x613x.h"
#include <msp430.h>
#include <string.h>
void terminal_write();
void UART_open();
void UART_close();
void main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
//__delay_cycles( 2 * 1e7);
while(1)
{
UART_open();
printf("system working\r\n");
terminal_write("AT\r\n");
__delay_cycles(5000000);
//_bis_SR_register(LPM3_bits + GIE);
UART_close();
}
}
void terminal_write(char *info)
{
unsigned int i;
unsigned int len = strlen(info) ;
for(i=0;i<len;i++)
{
UCA0TXBUF=info[i];
__delay_cycles(10000);
}
}
void UART_open(){
P1SEL |= BIT5 + BIT6;
//UART Settings
UCA0CTL1 |= UCSWRST;
UCA0CTL1 |= UCSSEL0 ; // ACLK
UCA0BR0=3; //UCA0BR0 = 3 ; //32Khz / 9600 –>> 3
UCA0BR1=0; //UCA0BR1=0; // BAUD 9600; ( UCABR1 * 256 ) + UCABR0 = UCABRx see "slau259e.pdf"
UCA0MCTL=6 ; // see "slau259e.pdf" page 602 //
//UCA0MCTL =| BIT7 | BIT6 | BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0 |
// |------- UCBRFx --------------|----UCBRSx----------|UCOS16|
// for 9600 baudrate at 32kHz UCBRFx = 0 , UCBRSx = 3 , UCOS16 = 0
// | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 |
// 0b00000110 = 0x06 = 6
UCA0CTL1 &=~ UCSWRST;//
UCA0CTL1 |= UCDORM;
}
void UART_close(){
P1SEL &= ~(BIT5 + BIT6);
UCA0CTL1 |= UCSWRST;
UCA0CTL1 &=~ UCDORM;
}
Beside if I use DC power then the system consumption is about 450-550 uA. If I use debugger then the DC power consumption is raises to about 4.8 mA . Also if I only use the debugger [powered with debugger voltage without using any external DC supply] then system can't handle the communication properly.
If there is a solutiion I'll very appreciate.
【问题讨论】:
-
这听起来不像是软件问题。试试electronics.stackexchange.com。
-
啊,谢谢,我不知道电子交换。我会在那里试试我的机会:)