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

Problem with setting two uart on pca10040 board

Problem with setting two uart on pca10040 board

hello

I am reading the log by teraterm by connecting pca10040 board to PC via USB.

I am trying to connect 6pin and 8pin of the board to other devices through uart.

The example used ble_app_uart.

The problem occurs with NRF_BREAKPOINT_COND in uart init.

In my opinion, it seems to conflict with printf output to teraterm and 6,8 pin uart.

Is there a way to use two uarts separately?

//best regards

Parents
  • Hello,

    Is there a way to use two uarts separately?

    Unfortunately no, the nRF52832 SoC only has 1 UART instance.

    The problem occurs with NRF_BREAKPOINT_COND in uart init.

    I would think this error you are seeing is from trying to initialize the one instance twice.
    If you would like to verify this, please add DEBUG to your preprocessor defines as shown in the included picture, to see what error is being generated.

    I am trying to connect 6pin and 8pin of the board to other devices through uart.

    What other devices are you trying to connect with? Perhaps the other devices support another serial interface?

    Best regards,
    Karl 

  • Thanks for your kind response.

    The device I am trying to connect is the IMU Module.

    I am trying to connect the uart pin (vcc,gnd,rx,tx) of the device with the PCA10040 board.

    The purpose is to send the value of the IMU Module to the PCA10040 board

    and then send the value back to the terminal of the PC via USB.

    Recompiled using the method you indicated.

    DEBUG Massage

    Is there any way to solve the problem?

    Best regards,

    tobaro4

Reply
  • Thanks for your kind response.

    The device I am trying to connect is the IMU Module.

    I am trying to connect the uart pin (vcc,gnd,rx,tx) of the device with the PCA10040 board.

    The purpose is to send the value of the IMU Module to the PCA10040 board

    and then send the value back to the terminal of the PC via USB.

    Recompiled using the method you indicated.

    DEBUG Massage

    Is there any way to solve the problem?

    Best regards,

    tobaro4

Children
  • Hello Tobaro,

    tobaro4 said:

    The device I am trying to connect is the IMU Module.

    I am trying to connect the uart pin (vcc,gnd,rx,tx) of the device with the PCA10040 board.

    The purpose is to send the value of the IMU Module to the PCA10040 board

    and then send the value back to the terminal of the PC via USB.

    Thank you for the clarification.

    The error NRF_ERROR_SVC_HANDLER_MISSING is often caused by not having enabled the SoftDevice (using sd_ble_enable) or if the headers included for the SoftDevice are not the correct headers for the particular SoftDevice you are using.
    Could you verify that you have indeed enabled the SoftDevice, and that the included headers match the particular SoftDevice you are using?

    Best regards,
    Karl

  • Thank you.

    If it is sd_ble_enable, do you mean NRF_SDH_BLE_ENABLED in sdk_config.h?

    If so, it is active.

    If not, can you tell me which SoftDevice to set up?

    Sorry, but maybe I didn't understand your advice.

    add

    It leaves a detailed compilation error message:

    <info> app_timer: RTC: initialized.
    <error> app: Communication error occurred while handling UART.
    <error> app: ERROR 1 [NRF_ERROR_SVC_HANDLER_MISSING] at C:\work\99.study\nordic\Nordic_SDK_v17\nRF5_SDK_17.0.0_9d13099\examples\ble_central\ble_app_uart_c\main.c:394
    PC at: 0x00027587
    <error> app: End of error report

    I searched for the related error message:

    https://devzone.nordicsemi.com/f/nordic-q-a/37193/nrf_error_svc_handler_missing-of-uart

    There is something like this, but I still don't understand.

    Best regards,

    tobaro4

  • Hello Tobaro4,

    tobaro4 said:
    Thank you.

    No problem at all, I am happy to help!

    tobaro4 said:

    If it is sd_ble_enable, do you mean NRF_SDH_BLE_ENABLED in sdk_config.h?

    If so, it is active.

    If not, can you tell me which SoftDevice to set up?

    Sorry, but maybe I didn't understand your advice.

    I will try to be more specific. Please let me know if anything still should be unclear.
    In the unmodified ble_app_uart example the SoftDevice is enabled as part of the ble_stack_init function ( specifically during the nrf_sdh_enable_request ).
    Have you made any changes to this?
    Does your application start, or could you go into debugger mode to see if the application gets past this function call at all?
    If it does not, then there is a problem with the SoftDevice configuration or setup.

    tobaro4 said:

    I searched for the related error message:

    https://devzone.nordicsemi.com/f/nordic-q-a/37193/nrf_error_svc_handler_missing-of-uart

    There is something like this, but I still don't understand.

    This is a good find, and may apply to your situation if the debugging check I mentioned above does not produce anything. If your application is able to start, and begin communication before suddenly failing during uart transfer, then it might indeed be an overrun error.
    In that case, we will need to take a look at the buffer size you have specified, and how frequently they are processed and emptied.

    Best regards,
    Karl

  • I know you're doing your best for me. Thanks for this.


    But I am completely newbie on this part. I'm using an unmodified example and I don't know how to fix it.
    Should I call the ble_stack_init() function before the uart_init() function? I really don't understand. I'm really sorry.


    If the IMU device is connected to the rx pin, the program will not run. If you don't connect the rx pin, the program will run. However, if I connect the rx pin while the program is running, it dies quickly. It seems to die reading about 147 bytes. How to process or empty the buffer size?

    Best regards,

    tobaro4

  • tobaro4 said:
    I know you're doing your best for me. Thanks for this.
    tobaro4 said:
    But I am completely newbie on this part. I'm using an unmodified example and I don't know how to fix it.

    It is truly no problem at all, do not worry :) 

    tobaro4 said:
    Should I call the ble_stack_init() function before the uart_init() function? I really don't understand. I'm really sorry.

    Lets take it from the start instead. Have you tried running an unmodified version of the example? I.e, does the example work as intended when you program your device with an unmodified version?
    The unmodified Nordic UART peripheral example should behave as described in its documentation.

    When we have confirmed that this is working as intended, then we may move on to modifying the example to suit the needs of your application. 

    tobaro4 said:
    If the IMU device is connected to the rx pin, the program will not run. If you don't connect the rx pin, the program will run. However, if I connect the rx pin while the program is running, it dies quickly.

    This is very interesting. Could you elaborate what you mean when you say that the program dies, or what happens if it does not start at all?
    Perhaps this is caused by the buffers being overrun.

    tobaro4 said:
    It seems to die reading about 147 bytes. How to process or empty the buffer size?

    Is it an option to use flow control on the UART communication to the IMU?
    Or, could you share the parts of the code in which you empty / process the contents of the RX buffer?

    Looking forward to resolving this issue together!

    Best regards,
    Karl

Related