peripheral uart unstable

Hi,

i am running the peripheral uart exsample on a thingy52. using a usb/ttl converter on my PC and conect it to P0.2 and P0.3.

then using Terminal program on pc and nrf tool on my mobile phone. It works fine for a time, it sends a msg over nus after cr,lf in the end of msg.

after reconect of bt it change to send data over nus only when buffer is full, not at the end of msg.

I am using sdk2.10 and unchanged exsample.

Parents
  • Does this switch case look like this for UART_RX_RDY in your uart_cb() function?

    	case UART_RX_RDY:
    		LOG_DBG("UART_RX_RDY");
    		buf = CONTAINER_OF(evt->data.rx.buf, struct uart_data_t, data);
    		buf->len += evt->data.rx.len;
    
    		if (disable_req) {
    			return;
    		}
    
    		if ((evt->data.rx.buf[buf->len - 1] == '\n') ||
    		    (evt->data.rx.buf[buf->len - 1] == '\r')) {
    			disable_req = true;
    			uart_rx_disable(uart);
    		}
    
    		break;

    Does the UART_RX_RDY case occur when it doesn't trigger on \r or \n? Is "disable_req" for some reason set to true?

    Does the log on the Thingy say anything?

    Best regards,

    Edvin

  • Hi Edvin,

    Yes, my UART_RX_RDY is excactly like yours.

    before i build the the application i selected the "Enable UART async adapter" under "nordic UART BLE GATT service sample" in the Kconfig. at that seems to make it moore stabile, 

    CONFIG_UART_ASYNC_API=y is in the prj.conf so why?

    Anyway this is only my first step. 

    I use this Peripheral_uart eksample on THINGY:52 and Central_uart on a Thingy:91_nrf52 and a uart connection to Thingy:91_nrf91.

    my proble is now on the Thingy:91 and the uart connection between nrf52 and nrf91 internaly: 

    The problem is that the nrf52 does not send anything out on the pin, i got UART_TX_DONE from my debug.

    I am able to get data from nrf91 and i can scope the data on SB8. but none from nrf52 SB7.

    is there any pin conflict that i am missing?

    nrf52840dk_nrf52840.overlay

    &uart1 {
    	current-speed = <115200>;
    	status = "okay";
    	/delete-property/ hw-flow-control;
    	pinctrl-0 = <&uart1_default>;
    	pinctrl-1 = <&uart1_sleep>;
    	pinctrl-names = "default", "sleep";
    };
    
    
    &pinctrl {
    
    	uart1_default: uart1_default {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 21)>,
    					<NRF_PSEL(UART_RX, 1, 0)>;
    					
    		};
    	};
    
    	uart1_sleep: uart1_sleep {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 21)>,
    					<NRF_PSEL(UART_RX, 1, 0)>;
    			low-power-enable;
    		};
    	};
    
    };

    Thingy91_nrf9160_ns.overlay

    &uart1 {
    	current-speed = <115200>;
    	status = "okay";
    	/delete-property/ hw-flow-control;
    	pinctrl-0 = <&uart1_default>;
    	pinctrl-1 = <&uart1_sleep>;
    	pinctrl-names = "default", "sleep";
    };
    
    
    &pinctrl {
    
        uart1_default: uart1_default {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 22)>;		
    		};
    		group2 {
    			psels =<NRF_PSEL(UART_RX, 0, 21)>;
    			//bias-pull-up;
    		};
    	};
    
    	uart1_sleep: uart1_sleep {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 22)>,
    					<NRF_PSEL(UART_RX, 0, 21)>;
    			low-power-enable;
    		};
    	}; 
    };
    

    I have tryed all MCU_IF pins with same result 

  • runved said:
    I am able to get data from nrf91 and i can scope the data on SB8. but none from nrf52 SB7.

    I am not familiar with the Thingy52 on that level. Is Solder Bridge 7 routed to the P0.21 on the nRF52832?

    Edvin said:

    Does the UART_RX_RDY case occur when it doesn't trigger on \r or \n? Is "disable_req" for some reason set to true?

    Did you try to debug this?

    BR,
    Edvin

Reply Children
No Data
Related