nRF9160 UART Communication to External MCU

Hello, 

We are trying to get UART communication between nRF9160 and MSP430. 

MSP430 need to send out a sensor data through UART. 

We are using 1.9.1 SDK, and Visual Studio as IDE.

The code gets caught up on "uart_irq_callback_set", and reboots the device right after that line. 

Overlay file:

/ {
chosen {
zephyr,bt-uart=&uart1;
};
};
&uart1 {
compatible = "nordic,nrf-uarte";
current-speed = <115200>;
status = "okay";
tx-pin = <00>;
rx-pin = <01>;
rts-pin = <0xFFFFFFFF>;
cts-pin = <0xFFFFFFFF>;
};

Configuration:

CONFIG_SERIAL=y
CONFIG_TRUSTED_EXECUTION_NONSECURE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_BSD_LIBRARY_TRACE_ENABLED=n
CONFIG_MAIN_STACK_SIZE=4096

Point b is an entrance into callback. What could be potential reasons/ways to debug?

Parents Reply Children
  • Hello, we tried that, and switched pins, but it still gets stacked at the exactly the same spot. 

  • Hi, sorry for the late reply

    It seems to work fine for me. Take a look at this and see if it helps you spot the issue. Might be the callback function.

    1072.uart_test.zip

  • Hey, thanks for the help. We used the project you provided as a baseline and by adding the necessary interrupt handling functions one by one discovered that the issue was not with the callback function in particular but rather with the uart_irq_rx_enable function. Again, the issue is a continuous reboot of the Zephyr RTOS if this function is present at all. The runtime does not even enter main if this function is present, whereas if it is not present, everything executes.

     Output with no interrupt enable

    Above is the output without the uart_irq_rx_enable line. Notice the good behavior of both debug messages being printed and no unintended Zephyr reboots.

    Above is the output with the uart_irq_rx_enable line. Notice that the debug text indicating main() has been entered is never printed, but instead Zephyr simply reboots again.

    Finally, above is the updated code based on the example you've sent. Using the example as provided did not actually include any means of handling interrupts; therefore, we had to add a few functions to get any use out of the project.

  • I should add that the error with uart_irq_rx_enable only occurs when we are actively transmitting to the nrf9160. Therefore, there is probably some issue with how we are handling the interrupt. It's not possible to determine this through debugging as far as I can tell since every time the Zephyr OS reboots, it eliminates the record of printed debug statements. Is there any way to overcome this?

Related