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

nrf_serial_write not working

This is my code:

void send_serial_message(char *buffer, size_t length) {
	ret_code_t ret;
	
	//DEBUG
	NRF_LOG_INFO("tx buffer length = %d", length);
	for(int i=0; i<length; i++)
	{
		NRF_LOG_INFO("%02x", buffer[i]);
	}
	//DEBUG end
	
    nrf_gpio_pin_set(TRANSMIT_ENABLE);
	ret = nrf_serial_write(&serial1_uart,
	                           buffer,
	                           length,
	                           NULL,
	                           NRF_SERIAL_MAX_TIMEOUT);
	APP_ERROR_CHECK(ret);
    NRF_LOG_INFO("serial return val: 0x%x", ret);
}

This is the results of the logs in the code: 

<info> app: tx buffer length = 8
<info> app: AA
<info> app: FF
<info> app: 10
<info> app: 08
<info> app: F7
<info> app: 10
<info> app: 10
<info> app: D8
<info> app: serial return val: 0x0

The return code shows that it was "successful." However, the serial write is not working properly. Here is what I measure using a logic analyzer on the serial transmission pin:

This is showing the 0xAA gets sent properly, but then the line goes low, and the rest of the sequence fails to transmit. 

What is happening??

Parents
  • Hi 

    Which Nordic chip and SDK version are you using?

    Is the UART TX pin to connected to anything externally, or is it floating?

    If it is connected to some other UART device are you able to remove this device to verify whether or not it is the nRF device pulling the TX line low?

    I don't know of any known issue with the UART where it would pull the TX line into a break condition like this, unless something is wrong with the GPIO configuration. 

    Best regards
    Torbjørn

Reply
  • Hi 

    Which Nordic chip and SDK version are you using?

    Is the UART TX pin to connected to anything externally, or is it floating?

    If it is connected to some other UART device are you able to remove this device to verify whether or not it is the nRF device pulling the TX line low?

    I don't know of any known issue with the UART where it would pull the TX line into a break condition like this, unless something is wrong with the GPIO configuration. 

    Best regards
    Torbjørn

Children
  • Nordic chip and SDK version

    NRF52840, SDK 14.2

    Is the UART TX pin to connected to anything externally, or is it floating?

    UART TX pin is connected to a serial bus (on which other devices can also communicate) via an external serial communications chip.

    I cannot remove this device because it is a soldered-on component on my PCB.

    I am using P1.14 for the UART TX pin.

    If it is connected to some other UART device are you able to remove this device to verify whether or not it is the nRF device pulling the TX line low?

    I do have a Rigado BMD 340 development kit, which also uses the NRF52840. I can use this to see if the same result happens in the absence of the external device.

Related