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

Failed to prepare RAMCode using RAM

Hi,

I have a project which is intended to log data via the UART port. 

When I enable BACKEND LOG via RTT (NRF_LOG_BACKEND_RTT_ENABLED = 1). I'm able to view output via the RTTViewer.

However, when I switch over and enable using backend (NRF_LOG_BACKEND_UART_ENABLED = 1), then the application fails. 
The function log_init() fails when nrf_drv_uart_init() is called because UARTE_PRESENT is defined.

I'm using an nrf52 DK, with nrf52832 installed in it.

Any help will be appreciated.

Thank you.

Parents
  • Does nrf_drv_uart_init() return NRFX_ERROR_INVALID_STATE (=0x8)? Have you already initialized it? Try setting a breakpoint in the function and see where it is initially called from.

    What example are you using?

    Best regards,

    Simon

  • Hi Simon,

    Thanks for responding.

    Yes indeed it is returning an INVALID_STATE. This is because I had previously initialized it.
    In my application I use the UART interface for a custom protocol, so I initialize a uart event handler. 
    When log_init() is called, it also tries to initialize the same UART interface with it's own handler. This is what causes the crash.

    The log uart_event handler would clash with my custom protocol handler as they would both contend for the same resource.

    So I've resorted to using printf statements with RETARGET_ENABLE set to 1. This causes my print logs to appear on the UART interface without disrupting my custom protocol.

    Thank you. 

Reply
  • Hi Simon,

    Thanks for responding.

    Yes indeed it is returning an INVALID_STATE. This is because I had previously initialized it.
    In my application I use the UART interface for a custom protocol, so I initialize a uart event handler. 
    When log_init() is called, it also tries to initialize the same UART interface with it's own handler. This is what causes the crash.

    The log uart_event handler would clash with my custom protocol handler as they would both contend for the same resource.

    So I've resorted to using printf statements with RETARGET_ENABLE set to 1. This causes my print logs to appear on the UART interface without disrupting my custom protocol.

    Thank you. 

Children
Related