This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf52832: EasyDMA & UARTE0 RX - ERRORSRC: 0x0C - SDK 12.0

Hello Nordic,

I  have a problem regarding UARTE0 and Easy DMA with SDK 12.0. I know, this is an old SDK, but unfortunately I'm not allowed to change it.

The TX part works fine. DMA works, everything perfect.

But at the moment when NRF_UARTE_TASK_STARTRX is triggered with following call:

__STATIC_INLINE void nrf_uarte_task_trigger(NRF_UARTE_Type * p_reg, nrf_uarte_task_t task)
{
    *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL;
}

I get the framing and break error with ERRORSRC: 0x0C. The signals are pretty clear and everything looks good, but I always get the error IRQ.

Does anybody has an idea why?

My problem is very simelar to this case

https://devzone.nordicsemi.com/f/nordic-q-a/44373/nrf52832-errorsrc-0xc-with-uarte0-when-starting-rx

thats the reason why I first answered that topic, but nobody answered, so this is the next try. Hope it helps. It's driving me crazy that I can't get a simple UARTE to work...

Thanks in advance!

Parents
  • Hi,

    Are you running this on a nRF52 DK or on a custom board? Did you write your own driver, or do you use one of the libraries from the SDK? 

    Can you post project/code that can be used to reproduce the issue?

    Best regards,
    Jørgen

  • Hi and thanks for the answer!

    I'm using a custom board but that should not be a problem. Signals are good and I get a good running Uart Rx part with my own quick and dirty low level uart driver without dma. 

    In series I'm using a slightly changed nrf_drv_uart 

    I changed the gpio config -> pullup:

    __STATIC_INLINE void apply_config(nrf_drv_uart_t const * p_instance, nrf_drv_uart_config_t const * p_config)
    {
        nrf_gpio_pin_set(p_config->pseltxd);
        nrf_gpio_cfg_output(p_config->pseltxd);
        nrf_gpio_cfg_input(p_config->pselrxd, NRF_GPIO_PIN_PULLUP); 
    
        CODE_FOR_UARTE
        (
            nrf_uarte_baudrate_set(p_instance->reg.p_uarte, (nrf_uarte_baudrate_t)p_config->baudrate);
            nrf_uarte_configure(p_instance->reg.p_uarte, (nrf_uarte_parity_t)p_config->parity,
                                (nrf_uarte_hwfc_t)p_config->hwfc);
            nrf_uarte_txrx_pins_set(p_instance->reg.p_uarte, p_config->pseltxd, p_config->pselrxd);
            if (p_config->hwfc == NRF_UART_HWFC_ENABLED)
            {
                nrf_gpio_cfg_input(p_config->pselcts, NRF_GPIO_PIN_PULLUP); 
                nrf_gpio_pin_set(p_config->pselrts);
                nrf_gpio_cfg_output(p_config->pselrts);
                nrf_uarte_hwfc_pins_set(p_instance->reg.p_uarte, p_config->pselrts, p_config->pselcts);
            }
        )
        CODE_FOR_UART
        (
            nrf_uart_baudrate_set(p_instance->reg.p_uart, p_config->baudrate);
            nrf_uart_configure(p_instance->reg.p_uart, p_config->parity, p_config->hwfc);
            nrf_uart_txrx_pins_set(p_instance->reg.p_uart, p_config->pseltxd, p_config->pselrxd);
            if (p_config->hwfc == NRF_UART_HWFC_ENABLED)
            {
                nrf_gpio_cfg_input(p_config->pselcts, NRF_GPIO_PIN_PULLUP); 
                nrf_gpio_pin_set(p_config->pselrts);
                nrf_gpio_cfg_output(p_config->pselrts);
                nrf_uart_hwfc_pins_set(p_instance->reg.p_uart, p_config->pselrts, p_config->pselcts);
            }
        )
    }

    I changed IRQ enable / disable:

    __STATIC_INLINE void interrupts_enable(const nrf_drv_uart_t * p_instance, uint8_t interrupt_priority)
    {
        CODE_FOR_UARTE
        (
            nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ENDRX);
            nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ENDTX);
            nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ERROR);
            nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_RXTO);
            nrf_uarte_int_enable(p_instance->reg.p_uarte, NRF_UARTE_INT_ENDRX_MASK |
                                             NRF_UARTE_INT_ENDTX_MASK |
                                             NRF_UARTE_INT_ERROR_MASK |
                                             NRF_UARTE_INT_RXTO_MASK);
            
            nrf_drv_common_irq_enable(nrf_drv_get_IRQn((void *)p_instance->reg.p_uarte), interrupt_priority);
        )
        CODE_FOR_UART
        (
            nrf_uart_event_clear(p_instance->reg.p_uart, NRF_UART_EVENT_TXDRDY);
            nrf_uart_event_clear(p_instance->reg.p_uart, NRF_UART_EVENT_RXTO);
            nrf_uart_int_enable(p_instance->reg.p_uart, NRF_UART_INT_MASK_TXDRDY |
                                           NRF_UART_INT_MASK_RXTO);
        
            nrf_drv_common_irq_enable(nrf_drv_get_IRQn((void *)p_instance->reg.p_uart), interrupt_priority);
        )    
    }
    
    
    
    
    
    __STATIC_INLINE void interrupts_disable(const nrf_drv_uart_t * p_instance)
    {
        CODE_FOR_UARTE
        (
            nrf_uarte_int_disable(p_instance->reg.p_uarte, NRF_UARTE_INT_ENDRX_MASK |
                                              NRF_UARTE_INT_ENDTX_MASK |
                                              NRF_UARTE_INT_ERROR_MASK |
                                              NRF_UARTE_INT_RXTO_MASK);
        
            nrf_drv_common_irq_disable(nrf_drv_get_IRQn((void *)p_instance->reg.p_uarte));
        )
        CODE_FOR_UART
        (
            nrf_uart_int_disable(p_instance->reg.p_uart, NRF_UART_INT_MASK_RXDRDY |
                                            NRF_UART_INT_MASK_TXDRDY |
                                            NRF_UART_INT_MASK_ERROR  |
                                            NRF_UART_INT_MASK_RXTO);
        
            nrf_drv_common_irq_disable(nrf_drv_get_IRQn((void *)p_instance->reg.p_uart));
        )
    }

    And I changed the address get functions:

    #ifndef SUPPRESS_INLINE_IMPLEMENTATION
    __STATIC_INLINE uint32_t nrf_drv_uart_task_address_get(nrf_drv_uart_t const * p_instance,
                                                           nrf_uart_task_t task)
    {
        #ifdef UART_IN_USE
            return nrf_uart_task_address_get(p_instance->reg.p_uart, task);
        #else
            return nrf_uarte_task_address_get(p_instance->reg.p_uarte, (nrf_uarte_task_t)task);
        #endif    
    }
    
    __STATIC_INLINE uint32_t nrf_drv_uart_event_address_get(nrf_drv_uart_t const * p_instance,
                                                            nrf_uart_event_t event)
    {
        #ifdef UART_IN_USE
            return nrf_uart_event_address_get(p_instance->reg.p_uart, event);
        #else
            return nrf_uarte_event_address_get(p_instance->reg.p_uarte, (nrf_uarte_event_t)event);
        #endif
    }
    #endif //SUPPRESS_INLINE_IMPLEMENTATION

    I read a lot and those are the problems I found in the SDK.

    This is my IRQ Handler. Pretty straight forward, nothing special and no data management yet.

    I hope this helps!

    void NdrvUart0IrqHandler(nrf_drv_uart_event_t * p_event, void * p_context)
    {
        switch (p_event->type)
        {
            case NRF_DRV_UART_EVT_TX_DONE:
               
                ndrv_fpUart0TxCallback();
    
                nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_TXDRDY);
                break;  
            case NRF_DRV_UART_EVT_RX_DONE:
    
                ndrv_fpUart0RxCallback();
            
                nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_RXDRDY);
            
                break;
            case NRF_DRV_UART_EVT_ERROR:
                
                /* Clear all events */
                nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_TXDRDY);
                nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_RXDRDY);
                nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_RXTO);
                nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_ERROR);
                nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_CTS);
                nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_NCTS);
            
                break;
            default:
                break;
        }     
    }

  • oh and this is my Uart init:

    void API_NdrvUart0Init(void)
    {   
        sd_clock_hfclk_request();
        
        nrf_drv_uart_config_t ndrv_nrf_uart0_config = NRF_DRV_UART_DEFAULT_CONFIG;
        
        ndrv_nrf_uart0_config.pseltxd            = C_GPIO_DALI_UART_TX;                             
        ndrv_nrf_uart0_config.pselrxd            = C_GPIO_DALI_UART_RX;                             
        
        
        ndrv_nrf_uart0_config.hwfc               = NRF_UART_HWFC_DISABLED;
        ndrv_nrf_uart0_config.parity             = NRF_UART_PARITY_EXCLUDED;      
        ndrv_nrf_uart0_config.baudrate           = NRF_UART_BAUDRATE_19200;                
        
        
        nrf_drv_uart_init( &ndrv_nrf_uart0_m, &ndrv_nrf_uart0_config, NdrvUart0IrqHandler );    
    }

Reply
  • oh and this is my Uart init:

    void API_NdrvUart0Init(void)
    {   
        sd_clock_hfclk_request();
        
        nrf_drv_uart_config_t ndrv_nrf_uart0_config = NRF_DRV_UART_DEFAULT_CONFIG;
        
        ndrv_nrf_uart0_config.pseltxd            = C_GPIO_DALI_UART_TX;                             
        ndrv_nrf_uart0_config.pselrxd            = C_GPIO_DALI_UART_RX;                             
        
        
        ndrv_nrf_uart0_config.hwfc               = NRF_UART_HWFC_DISABLED;
        ndrv_nrf_uart0_config.parity             = NRF_UART_PARITY_EXCLUDED;      
        ndrv_nrf_uart0_config.baudrate           = NRF_UART_BAUDRATE_19200;                
        
        
        nrf_drv_uart_init( &ndrv_nrf_uart0_m, &ndrv_nrf_uart0_config, NdrvUart0IrqHandler );    
    }

Children
No Data
Related