主题中讨论的其他器件: MSP430G2553
工具与软件:
工具:CCS 12.7.1
大家好!
有人在运行 此 Resource Explorer UART 示例时遇到此错误?
此外、还会出现一些奇怪的字符、无需键入。
感谢您的任何帮助!
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
工具与软件:
工具:CCS 12.7.1
大家好!
有人在运行 此 Resource Explorer UART 示例时遇到此错误?
此外、还会出现一些奇怪的字符、无需键入。
感谢您的任何帮助!
如果程序的.data/.bss "太大"、并且看门狗在 C 初始化期间关闭、则可能会出现此症状。 TI 示例可能不会是这样的理想选择、因为它们都很小。
FR2433 Launchpad (以及另一个、我想)产生了一个赝像:它是随使用 RTC、尤其是 RTCIE 的程序一起提供的。 第一次对其进行编程时、调试器复位不会重置 RTC、而在新代码中中断会关闭、进而进入故障 ISR。 我(模糊)回忆起不同的可见症状、但这也返回到 CCSv8中、同时可能有所变化。 对 Launchpad 进行下电上电(在加载新代码后)应清除此特定条件。
嗯,我尝试了另一种方法,复制什么 成功在 msp430g2553上工作,但没有 在它
#include <msp430.h> void Software_Trim(); // Software Trim to get the best DCOFTRIM value void ser_output(unsigned char*); #define MCLK_FREQ_MHZ 1 // MCLK = 1MHz unsigned char TXData[] = "Test\n\r"; int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer __bis_SR_register(SCG0); // Disable FLL CSCTL3 = SELREF__REFOCLK; // Set REFO as FLL reference source CSCTL1 = DCOFTRIMEN | DCOFTRIM0 | DCOFTRIM1 | DCORSEL_0;// DCOFTRIM=3, DCO Range = 1MHz CSCTL2 = FLLD_0 + 30; // DCODIV = 1MHz __delay_cycles(3); __bic_SR_register(SCG0); // Enable FLL Software_Trim(); // Software Trim to get the best DCOFTRIM value CSCTL4 = SELMS__DCOCLKDIV | SELA__REFOCLK; // set default REFO(~32768Hz) as ACLK source, ACLK = 32768Hz // default DCODIV as MCLK and SMCLK source PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default high-impedance mode // to activate previously configured port settings P1DIR |= BIT0; P1OUT &= ~(BIT0); // P1.0 out low // Configure UART pins P1SEL0 |= BIT4 | BIT5; // set 2-UART pin as second function // Configure UART UCA0CTLW0 |= UCSWRST; // Put eUSCI in reset UCA0CTLW0 |= UCSSEL__SMCLK; // Baud Rate calculation UCA0BR0 = 104; // 1000000/9600 = 104.16 UCA0BR1 = 0; UCA0MCTLW = 0x2000 | UCOS16 | UCBRF_2; // 1000000/9600 - INT(1000000/9600)=0.16 // UCBRFx = int (0.16*16) = 2; 16 bcz of UCOS16 // UCBRSx value = 0x20 (See UG table 22-5) UCA0CTLW0 &= ~UCSWRST; // Initialize eUSCI while (1) { P1OUT ^= BIT0; ser_output(TXData); __delay_cycles(1000000); } } void ser_output(unsigned char* str) { while(*str) { while(!(UCA0IFG&UCTXIFG)); UCA0TXBUF = *str++; } } void Software_Trim() { unsigned int oldDcoTap = 0xffff; unsigned int newDcoTap = 0xffff; unsigned int newDcoDelta = 0xffff; unsigned int bestDcoDelta = 0xffff; unsigned int csCtl0Copy = 0; unsigned int csCtl1Copy = 0; unsigned int csCtl0Read = 0; unsigned int csCtl1Read = 0; unsigned int dcoFreqTrim = 3; unsigned char endLoop = 0; do { CSCTL0 = 0x100; // DCO Tap = 256 do { CSCTL7 &= ~DCOFFG; // Clear DCO fault flag }while (CSCTL7 & DCOFFG); // Test DCO fault flag __delay_cycles((unsigned int)3000 * MCLK_FREQ_MHZ);// Wait FLL lock status (FLLUNLOCK) to be stable // Suggest to wait 24 cycles of divided FLL reference clock while((CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1)) && ((CSCTL7 & DCOFFG) == 0)); csCtl0Read = CSCTL0; // Read CSCTL0 csCtl1Read = CSCTL1; // Read CSCTL1 oldDcoTap = newDcoTap; // Record DCOTAP value of last time newDcoTap = csCtl0Read & 0x01ff; // Get DCOTAP value of this time dcoFreqTrim = (csCtl1Read & 0x0070)>>4;// Get DCOFTRIM value if(newDcoTap < 256) // DCOTAP < 256 { newDcoDelta = 256 - newDcoTap; // Delta value between DCPTAP and 256 if((oldDcoTap != 0xffff) && (oldDcoTap >= 256)) // DCOTAP cross 256 endLoop = 1; // Stop while loop else { dcoFreqTrim--; CSCTL1 = (csCtl1Read & (~DCOFTRIM0)) | (dcoFreqTrim<<4); } } else // DCOTAP >= 256 { newDcoDelta = newDcoTap - 256; // Delta value between DCPTAP and 256 if(oldDcoTap < 256) // DCOTAP cross 256 endLoop = 1; // Stop while loop else { dcoFreqTrim++; CSCTL1 = (csCtl1Read & (~DCOFTRIM0)) | (dcoFreqTrim<<4); } } if(newDcoDelta < bestDcoDelta) // Record DCOTAP closest to 256 { csCtl0Copy = csCtl0Read; csCtl1Copy = csCtl1Read; bestDcoDelta = newDcoDelta; } }while(endLoop == 0); // Poll until endLoop == 1 CSCTL0 = csCtl0Copy; // Reload locked DCOTAP CSCTL1 = csCtl1Copy; // Reload locked DCOFTRIM while(CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1)); // Poll until FLL is locked } // End of file
如果在 FR2433 Launchpad 上运行该模块、则需要在 PC 上打开设备管理器、并确定将哪个 COM 端口分配给"MSP430 application UART"。 请务必为您的终端应用指定这一点、并且它还设置为在9600波特下工作。