微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI蓝牙设计交流 > keyfob(cc2540) 串口0 高电平仅200mv!

keyfob(cc2540) 串口0 高电平仅200mv!

时间:10-02 整理:3721RD 点击:

1. 我的keyfob 串口一直不工作,用下面的测试用例,通过示波器发现p 0_3数据正常,但是高电平仅200mV

2.把p0_3配置成通用I/O,输出1时高电平 2.2V

请问,是配置的问题还是硬件问题?

void main (void)
{
/****************************************************************************
* Clock setup
* See basic software example "clk_xosc_cc254x"
*/

// Set system clock source to HS XOSC, with no pre-scaling.
CLKCONCMD = (CLKCONCMD & ~(CLKCON_OSC | CLKCON_CLKSPD)) | CLKCON_CLKSPD_32M;
// Wait until clock source has changed.
while (CLKCONSTA & CLKCON_OSC);

/* Note the 32 kHz RCOSC starts calibrating, if not disabled. */

// Configure USART0 for Alternative 1 => Port P0 (PERCFG.U0CFG = 0).
PERCFG = 0x00;

// Set pins 2, 3,4,5 as peripheral I/O
P0SEL |= 0x3c;
// Give priority to USART 0 over Timer 1 for port 0 pins.
P2DIR &= ~0xc0;

// Initialise bitrate = 57.6 kbps.
U0BAUD = UART_BAUD_M;
U0GCR = (U0GCR & ~U0GCR_BAUD_E) | UART_BAUD_E;

// Initialise UART protocol (start/stop bit, data bits, parity, etc.):
// USART mode = UART (U0CSR.MODE = 1)
U0CSR |= U0CSR_MODE;

// Start bit level = low => Idle level = high (U0UCR.START = 0).
U0UCR &= ~U0UCR_START;

// Stop bit level = high (U0UCR.STOP = 1).
U0UCR |= U0UCR_STOP;

// Number of stop bits = 1 (U0UCR.SPB = 0).
U0UCR &= ~U0UCR_SPB;

// Parity = disabled (U0UCR.PARITY = 0).
U0UCR &= ~U0UCR_PARITY;

// 9-bit data enable = 8 bits transfer (U0UCR.BIT9 = 0).
U0UCR &= ~U0UCR_BIT9;

// Level of bit 9 = 0 (U0UCR.D9 = 0), used when U0UCR.BIT9 = 1.
// Level of bit 9 = 1 (U0UCR.D9 = 1), used when U0UCR.BIT9 = 1.
// Parity = Even (U0UCR.D9 = 0), used when U0UCR.PARITY = 1.
// Parity = Odd (U0UCR.D9 = 1), used when U0UCR.PARITY = 1.
U0UCR &= ~U0UCR_D9;

// Flow control = disabled (U0UCR.FLOW = 0).
U0UCR &= ~U0UCR_FLOW;

// Bit order = LSB first (U0GCR.ORDER = 0).
U0GCR &= ~U0GCR_ORDER;


/***************************************************************************
* Transfer UART data
*/
while(1)
{
U0DBUF = 0x55;
while(! (U0CSR & U0CSR_TX_BYTE) );
U0CSR &= ~U0CSR_TX_BYTE;
}
}

你把串口的外围电路先排除掉看看电平是不是正确

请教:从CC2540keyfob_SCHEMATIC.pdf上看串口0直接引到DEBUG接口上,没有外围电路啊?

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top