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.

M4 uart each範例改為uart4無作用?

Other Parts Discussed in Thread: TM4C123GH6PM

如附件將範例修改為uart4但無作動,是否有少修改,

看暫存器好像是中斷,這兩個作動

UART_RIS_BERIS

UART_RIS_ FERIS

 該如何修改?

  • 没有发现程序有什么问题,配置都正常。

    仿真下不能跳入UART4中断服务函数吗。唯一的是你的中断向量表是否改变了。注意红色部分

    #pragma DATA_SECTION(g_pfnVectors, ".intvecs")
    void (* const g_pfnVectors[])(void) =
    {
    (void (*)(void))((uint32_t)&__STACK_TOP),
    // The initial stack pointer
    ResetISR, // The reset handler
    NmiSR, // The NMI handler
    FaultISR, // The hard fault handler
    IntDefaultHandler, // The MPU fault handler
    IntDefaultHandler, // The bus fault handler
    IntDefaultHandler, // The usage fault handler
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    IntDefaultHandler, // SVCall handler
    IntDefaultHandler, // Debug monitor handler
    0, // Reserved
    IntDefaultHandler, // The PendSV handler
    IntDefaultHandler, // The SysTick handler
    IntDefaultHandler, // GPIO Port A
    IntDefaultHandler, // GPIO Port B
    IntDefaultHandler, // GPIO Port C
    IntDefaultHandler, // GPIO Port D
    IntDefaultHandler, // GPIO Port E

    IntDefaultHandler, // UART0 Rx and Tx 
    //UARTIntHandler, // UART0 Rx and Tx
    IntDefaultHandler, // UART1 Rx and Tx
    IntDefaultHandler, // SSI0 Rx and Tx
    IntDefaultHandler, // I2C0 Master and Slave
    IntDefaultHandler, // PWM Fault
    IntDefaultHandler, // PWM Generator 0
    IntDefaultHandler, // PWM Generator 1
    IntDefaultHandler, // PWM Generator 2
    IntDefaultHandler, // Quadrature Encoder 0
    IntDefaultHandler, // ADC Sequence 0
    IntDefaultHandler, // ADC Sequence 1
    IntDefaultHandler, // ADC Sequence 2
    IntDefaultHandler, // ADC Sequence 3
    IntDefaultHandler, // Watchdog timer
    IntDefaultHandler, // Timer 0 subtimer A
    IntDefaultHandler, // Timer 0 subtimer B
    IntDefaultHandler, // Timer 1 subtimer A
    IntDefaultHandler, // Timer 1 subtimer B
    IntDefaultHandler, // Timer 2 subtimer A
    IntDefaultHandler, // Timer 2 subtimer B
    IntDefaultHandler, // Analog Comparator 0
    IntDefaultHandler, // Analog Comparator 1
    IntDefaultHandler, // Analog Comparator 2
    IntDefaultHandler, // System Control (PLL, OSC, BO)
    IntDefaultHandler, // FLASH Control
    IntDefaultHandler, // GPIO Port F
    IntDefaultHandler, // GPIO Port G
    IntDefaultHandler, // GPIO Port H
    IntDefaultHandler, // UART2 Rx and Tx
    IntDefaultHandler, // SSI1 Rx and Tx
    IntDefaultHandler, // Timer 3 subtimer A
    IntDefaultHandler, // Timer 3 subtimer B
    IntDefaultHandler, // I2C1 Master and Slave
    IntDefaultHandler, // Quadrature Encoder 1
    IntDefaultHandler, // CAN0
    IntDefaultHandler, // CAN1
    0, // Reserved
    0, // Reserved
    IntDefaultHandler, // Hibernate
    IntDefaultHandler, // USB0
    IntDefaultHandler, // PWM Generator 3
    IntDefaultHandler, // uDMA Software Transfer
    IntDefaultHandler, // uDMA Error
    IntDefaultHandler, // ADC1 Sequence 0
    IntDefaultHandler, // ADC1 Sequence 1
    IntDefaultHandler, // ADC1 Sequence 2
    IntDefaultHandler, // ADC1 Sequence 3
    0, // Reserved
    0, // Reserved
    IntDefaultHandler, // GPIO Port J
    IntDefaultHandler, // GPIO Port K
    IntDefaultHandler, // GPIO Port L
    IntDefaultHandler, // SSI2 Rx and Tx
    IntDefaultHandler, // SSI3 Rx and Tx
    IntDefaultHandler, // UART3 Rx and Tx
    //IntDefaultHandler, // UART4 Rx and Tx

    UARTIntHandler, // UART4 Rx and Tx

    需要改为UART4中断服务函数 
    IntDefaultHandler, // UART5 Rx and Tx
    IntDefaultHandler, // UART6 Rx and Tx
    IntDefaultHandler, // UART7 Rx and Tx
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    IntDefaultHandler, // I2C2 Master and Slave
    IntDefaultHandler, // I2C3 Master and Slave
    IntDefaultHandler, // Timer 4 subtimer A
    IntDefaultHandler, // Timer 4 subtimer B
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    IntDefaultHandler, // Timer 5 subtimer A
    IntDefaultHandler, // Timer 5 subtimer B
    IntDefaultHandler, // Wide Timer 0 subtimer A
    IntDefaultHandler, // Wide Timer 0 subtimer B
    IntDefaultHandler, // Wide Timer 1 subtimer A
    IntDefaultHandler, // Wide Timer 1 subtimer B
    IntDefaultHandler, // Wide Timer 2 subtimer A
    IntDefaultHandler, // Wide Timer 2 subtimer B
    IntDefaultHandler, // Wide Timer 3 subtimer A
    IntDefaultHandler, // Wide Timer 3 subtimer B
    IntDefaultHandler, // Wide Timer 4 subtimer A
    IntDefaultHandler, // Wide Timer 4 subtimer B
    IntDefaultHandler, // Wide Timer 5 subtimer A
    IntDefaultHandler, // Wide Timer 5 subtimer B
    IntDefaultHandler, // FPU
    0, // Reserved
    0, // Reserved
    IntDefaultHandler, // I2C4 Master and Slave
    IntDefaultHandler, // I2C5 Master and Slave
    IntDefaultHandler, // GPIO Port M
    IntDefaultHandler, // GPIO Port N
    IntDefaultHandler, // Quadrature Encoder 2
    0, // Reserved
    0, // Reserved
    IntDefaultHandler, // GPIO Port P (Summary or P0)
    IntDefaultHandler, // GPIO Port P1
    IntDefaultHandler, // GPIO Port P2
    IntDefaultHandler, // GPIO Port P3
    IntDefaultHandler, // GPIO Port P4
    IntDefaultHandler, // GPIO Port P5
    IntDefaultHandler, // GPIO Port P6
    IntDefaultHandler, // GPIO Port P7
    IntDefaultHandler, // GPIO Port Q (Summary or Q0)
    IntDefaultHandler, // GPIO Port Q1
    IntDefaultHandler, // GPIO Port Q2
    IntDefaultHandler, // GPIO Port Q3
    IntDefaultHandler, // GPIO Port Q4
    IntDefaultHandler, // GPIO Port Q5
    IntDefaultHandler, // GPIO Port Q6
    IntDefaultHandler, // GPIO Port Q7
    IntDefaultHandler, // GPIO Port R
    IntDefaultHandler, // GPIO Port S
    IntDefaultHandler, // PWM 1 Generator 0
    IntDefaultHandler, // PWM 1 Generator 1
    IntDefaultHandler, // PWM 1 Generator 2
    IntDefaultHandler, // PWM 1 Generator 3
    IntDefaultHandler // PWM 1 Fault
    };

  • 修改完中斷向量表(如附件),暫存器RIS還是一樣2AF無法收到資料,但藍色LED傳送時有亮

    我試著改為UART1,但變成傳送1(十進制)回傳64 0

  • 什么意思?还哪里有问题?

  • Uart0(原本範例uart_each),串口通訊正常

    但外拉pin腳,由rs232轉接usb(pl2303)進電腦讀取,會出現格式錯誤(如附件圖片)

    硬體有啥要注意?或是哪有問題?

    以前有在LM4F232H5QD  實習版測過轉接線是可以

    Uart0.docx
  • 你是直接用TI评估板测试,建议核对一下原理图。TI评估板上仿真器是直接接UART0,如果需要转接UART4,不知道你是如何改接的。

    另外LM4F232H5QD 和TM4C123GH6PM这两个是同一芯片,LM4这个是旧的PN。

  • 转接出去,应该也是OK的。你可以换其他的UART试试,因为默认Uart0接的是ICDI的引脚,这里会不会有影响呢?

  • 修改完中斷向量表

    直接由pin腳拉出經由rs232轉usb(市面上現成轉接線含轉換晶片,之前測過是正常)讀入電腦

    測試uart4,led燈有閃,但無收到資料

    換測試uart1,有收到資料但亂碼

    換回最原始code(uart0),usb讀入電腦都正常,但直接從pa0pa1接腳拉出,讀到是亂碼

    目前疑問是為何從pin腳拉出讀到是亂碼,還需啥轉換電路嗎?

  • 一切正常可以收發,少了TTL轉RS232 IC轉接進去電腦

    新手上路,感謝解答!!

  • 学习路上难免  

  • 血的教训呀。一般用USB转TTL就好了。