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
  • 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?

  • Hello I have the next scenario:

    I work with two boards:

    Texas PCB: EVM430-FR6047 MCU018 PCB Rev A

    Nordic Semiconductor PCB: nRF5340 DK

    The texas board is connected with a ultrasonic sensor and sends the flow volume data through uart protocol. So the idea if forwarding the data coming from the MSP430 (ultrasonic flow sensor) to the nRF5340 DK for further processing via uart.

    So I am wiring both PCBs this way:

     J3: TXD (black cable) --> nRF5340 DK P1.15 

    J3: RXD (purple cable) --> nRF5340 DK P1.14

    I'm trying to use the dev academy example as a guide but it doesn't even work for me, it builds fine but every time I pass them to nordic it only opens the segger folder.

    .

Related