Home Topics Help to activate UART4 Rx Interrupt

Overview Forums MikroElektronika’s mikroC Compiler and Software Tools Help to activate UART4 Rx Interrupt

This topic contains 1 reply, has 2 voices, and was last updated by  Uros Cvetinovic 2 years, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1656

    Toley
    Participant

    I’m working on Hexiwear with mikroC compiler. Actually I only try to access low level peripheral individually and then make some libraries to acces them. But I have soon realized that if I want to externally communicate with the device, I need to communicate with the other MCU (MK40) because this one is in charge of BLE and Touch Buttons.

    Communication between the 2 MCU is made via UART4 of the MK64. By pooling this UART I was able to intercept and decode some data. It’s clear that BLE will be very hard to use without reprogramming the MK40 but the touch buttons can be easily detected.

    But in real life, pooling is not an option. I really need to activate UART4 Rx Interrupt.

    I have try many combinations but here is the simplest code To try to get into interrupt.

    
    volatile char U4Rx;
    
    void UART4_RxTx_Int() iv IVT_INT_UART4_RX_TX ics ICS_AUTO
    {
        PTC_PDOR.B8 = 0;    // Red Led should light up if Interrupt is trigged
        U4Rx = UART4_Read();
        UART0_Write(U4Rx);
    }
    
    void main()
    {
        GPIO_Digital_Output(&PTC_PDOR, _GPIO_PINMASK_8);        // Red Led
        GPIO_Digital_Output(&PTC_PDOR, _GPIO_PINMASK_9);        // Blue Led
        GPIO_Digital_Output(&PTD_PDOR, _GPIO_PINMASK_0);        // Green led
        
        PTC_PDOR.B8 = 1;         // Light Down Red LED
        
        UART0_Init(230400);
        UART4_Init(230400);
    
        NVIC_IntEnable(IVT_INT_UART4_RX_TX);    // UART4 Interrupt
        EnableInterrupts();
    
        while(1);
    }
    

    But infortunately the interrupt is never trigged. Any help will be appreciated.

    • This topic was modified 3 years, 3 months ago by  Toley.
    • This topic was modified 3 years, 3 months ago by  Toley.
    • This topic was modified 3 years, 3 months ago by  Toley.
    #2157

    Uros Cvetinovic
    Moderator
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.