TI E2E™ 设计支持论坛将于 5 月 30 日至 6 月 1 日进行维护。如果您在此期间需要技术支持,请联系 TI 的客户支持中心寻求帮助。

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/TM4C123GH6PM:HC 05与 Tiva tm4c123ghpm

Guru**** 2046970 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/797322/ccs-tm4c123gh6pm-hc-05-with-tiva-tm4c123gh6pm

器件型号:TM4C123GH6PM

工具/软件:Code Composer Studio

无法发送或接收来自蓝牙模块 HC 05的数据、并在 CCS-中写入以下代码

#include
#include
#include
#include "inc/tm4c123gh6m.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "driverlib/timer.h"
#include "driverlib/interrupt.h"
#include
#include
#include" driverlib/pin_map.h"
#include" driverlib/sysctl.h"
#include" driverlib/uart.h"
#include" driverlib/uart.c"
#include "driverlib/adc.h"

//int32_t d='x';
unsigned char d;
int main (空)

   int u=0;
   /*设置蓝牙 UART*/
   SysCtlClockSet (SYSCTL_SYSDIV_10|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHz|SYSCTL_OSC_MAIN);
   SysCtlPeripheralEnable (SYSCTL_Periph_GPIOB);
   
   SysCtlPeripheralEnable (SYSCTL_Periph_GPIOF);
   SysCtlPeripheralEnable (SYSCTL_Periph_UART1);
   GPIOPinConfigure (GPIO_PB0_U1RX);
   GPIOPinConfigure (GPIO_PB1_U1TX);
   


   /*上拉 PB0和 PB1 */
   GPIOPadConfigSet (GPIO_PORTB_BASE、GPIO_PIN_0、GPIO_Strength _2mA、GPIO_PIN_TYPE_STD_WPU);

   /*使 UART 引脚受外设控制。 *
   GPIOPinTypeUART (GPIO_PORTB_BASE、GPIO_PIN_0 | GPIO_PIN_1);

 

   /*设置 UART 的配置。 *
   UARTConfigSetExpClk (UART1_base、16000000、9600、(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));



   // while (UARTCharsAvail (UART1_base));
   //
   // unsigned char d = UARTCharGet (UART1_base);



   //UARTCharPut (UART1_base、'b');


while (1)

   D = UARTCharGet (UART1_BASE);
   UARTCharPut (UART1_BASE、76);
       UARTCharPut (UART1_base、'b');
       UARTCharPut (UART1_base、'c');}

   返回0;


  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好!
    我有一些意见。

    您不需要下面的行。 当您调用 GPIOPinTypeUART()时,它将相应地为您配置引脚缓冲区。
    GPIOPadConfigSet (GPIO_PORTB_BASE、GPIO_PIN_0、GPIO_Strength _2mA、GPIO_PIN_TYPE_STD_WPU);

    -您可以使用以下选项配置系统时钟。 您正在使用 PLL 作为时钟源并将系统时钟配置为20MHz。 但是、您还可以使用16MHz 的输入 UART 时钟(或系统时钟)将 UART 时钟配置为9600波特率。 您应该将系统时钟更改为使用 OSC 而不是 PLL、或者将 UARTConfigSetExpClk 中的 UART 时钟配置为20Mhz、这是一种方法。
    SysCtlClockSet (SYSCTL_SYSDIV_10|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHz|SYSCTL_OSC_MAIN);
    UARTConfigSetExpClk (UART1_base、16000000、9600、(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));

    -使用示波器查看是否在 UARTTX 和 UARTRX 引脚上获得了正确的信号。