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

Transmitting data over UART_2 to external sensors

Hi Dev Team,

I have been trying to send data across from my nRF9160DK board to an external sensor via RS-485. For this, I have a TTL_RS485 converter in between.

To start off with, I just want to send a string and receive it on an external debugger to check my UART communication. I am using UART_2 and I am attaching my nrf9160dk_nrf9160ns.overlay file here. The wiring has been done based on uart_2 configuration. 

/* Needed to get NRF_PWMn defined. */


/ {
	model = "Nordic nRF9160 DK NRF9160";
	compatible = "nordic,nrf9160-dk-nrf9160";

	chosen {
		zephyr,console = &uart0;
		zephyr,shell-uart = &uart0;
		zephyr,uart-mcumgr = &uart0;
	};
};


&pwm1 {
	status = "okay";
};

&pwm2 {
	status = "okay";
};

&pwm3 {
	status = "okay";
};


&uart1 {
	current-speed = <9600>;
	status = "okay";
	tx-pin = <12>;
	rx-pin = <13>;
	rts-pin = <14>;
	cts-pin = <15>;
};



&uart2 {
	status = "okay";
	current-speed = <9600>;
	tx-pin = <10>;
	rx-pin = <11>;
	rts-pin = <16>;
	cts-pin = <17>;
};

The same is in the SPM folder as nrf9160dk_nrf9160.overlay file. 

The basic UART example in the master branch provides the structure to receive data from UART. Is there any particular example to send the data from the UART ?.

I tried following this thread : https://devzone.nordicsemi.com/f/nordic-q-a/44788/nrf9160-dk-send-receive-data-from-uart1/179149#179149  , but I get an error while trying to implement that code. The error I get is in Line 24 where k_fifo_get is defined. Is there any way to fix this issue ?

Is there any other example that shows how to transmit the strings externally through a UART (UART_2 in my case).

Regards,

Adeel.

Parents
  • Hi,

    As an addition, I am facing issues to communicate anything externally through UART_2. I tried 2 examples : C:\Users\adeel\ncs\v1.3.0\zephyr\tests\drivers\uart\uart_basic_api and the simple UART example in the master branch.

    All I am trying to do for now is to send a character string out to receive it on an external debugger connected to my sensor.

    Whatever changes I do and try to send , I can only see it in my LTE Link monitor i.e: connected to UART_0 by default I presume. 

    Can any of the above examples mentioned be tuned in order to send the data out (through UART_2)? I would really request a heads up on this :). 

Reply
  • Hi,

    As an addition, I am facing issues to communicate anything externally through UART_2. I tried 2 examples : C:\Users\adeel\ncs\v1.3.0\zephyr\tests\drivers\uart\uart_basic_api and the simple UART example in the master branch.

    All I am trying to do for now is to send a character string out to receive it on an external debugger connected to my sensor.

    Whatever changes I do and try to send , I can only see it in my LTE Link monitor i.e: connected to UART_0 by default I presume. 

    Can any of the above examples mentioned be tuned in order to send the data out (through UART_2)? I would really request a heads up on this :). 

Children
No Data
Related