Receive data via uart with nrf5340

hello, I am currently working on a project that involves sending data via serial from a device to the nordic nr5340.

but I can't find an example that shows how it would be in this case, in the course it tells me to use the asynchronous api, but in this case it is to enter the parameters in the console, so I would like you to please tell me an example so that I can make the configuration.

Currently what I know is that a configuration must be made to specify the pins since by default the nrf5340 receives is through the gpios that are connected to the usb, however in the case of how the data is handled it is still confusing for me

So could you please tell me where to start.

Parents Reply Children
  • Have you tried running the example from Lesson 5 of the devacademy course? You could try to printing rx_buf.

    There is also another sample demonstrating asynchronous UART. Please note that sample was tested using nRF Connect SDK v1.9.1. I suggest testing it using v1.9.1 before migrating it to v2.x.x.

  • hello greetings, I have been using that example as a base, but from what I understand is that this example is to be used with the console, and I do not fully understand how it would be for my case, since I currently have the following:

    1) I have 1 pcb connected via serial to nordic via pins 14 and 15, using the following configuration in my overlay file.

    &uart1 {
    		compatible = "nordic,nrf-uarte";
    		reg = <0x8000 0x1000>;
    		interrupts = <8 NRF_DEFAULT_IRQ_PRIORITY>;
    		status = "okay";
    		current-speed = <115200>;
    		pinctrl-0 = <&uart1_default>;
    		pinctrl-1 = <&uart1_sleep>;
    		pinctrl-names = "default", "sleep";
    };
    
    &uart1_default {
    		group1 {
    				psels = <NRF_PSEL(UART_TX, 1, 14)>;
    
    		};
    		group2 {
    				psels = <NRF_PSEL(UART_RX, 1, 15)>;
    			
    		};
    };
    &uart1_sleep {
    		group1 {
    				psels = <NRF_PSEL(UART_TX, 1, 14)>,
    				        <NRF_PSEL(UART_RX, 1, 15)>;					
    		
    		};
    };
    


    2) I am using the course example as a base, but I don't understand how to get the data, nor how to manipulate it. I know that in the callback function it tells me that I can access it but I don't understand how it does it and I would really like to have more clarity on that aspect.

  • Hi brando,

    I will get back to you with more details.

  • hello thanks for answering this problem too i tried to run the uart example from dev academy course but every time i build it gives me the following error:

    I tried to change the version, taking into account that in version 2.2.0 every time I build the application, some files are not generated in the zephir folder inside the build, but the error still persists, not only that but also when I try to pass it al nordic opens the folder where the segger part is, what do you suggest I do?

  • Hi brando,

    Sorry for the delay.

    brando14 said:
    every time i build it gives me the following error:

    Could you please check the build log from the 'terminal' tab in nRF Connect for VS Code?

    Sorry, I am a little confused regarding what you are working on. Is nRF5340 connected to a sensor or to another MCU that has a sensor connected to it? What would you like to do with the data you receive over UART on nRF5340?

Related