UART connect external MCU(STM32) transmit and recieved data

Hi 

    I need to send data from nRF7002 to external CPU(STM32) use UART protocol, for HW nRF7002 P0.20 connect STM32 RX and RF7002 P0.22 connect STM32 TX, I try to use exercise to modify send 8 bytes data and recieved from STM32 8 bytes data, there is no any data recieved data from STM32 and nRF7002, isn't I miss some config for this flow?below is my device three overlay and code, please give suggestion for this, Thanks.

&uart0_default {
	group1 {
		psels = <NRF_PSEL(UART_TX, 0, 20)>, <NRF_PSEL(UART_RTS, 0, 19)>;
	};
};

&uart0_sleep {
	group1 {
		psels = <NRF_PSEL(UART_TX, 0, 20)>,
				<NRF_PSEL(UART_RX, 0, 22)>,
				<NRF_PSEL(UART_RTS, 0, 19)>,
				<NRF_PSEL(UART_CTS, 0, 21)>;
	};
};
&uart0 {
	status = "okay";
	current-speed = <115200>;
	pinctrl-0 = <&uart0_default>;
	pinctrl-1 = <&uart0_sleep>;
	pinctrl-names = "default", "sleep";
};

#define RECEIVE_BUFF_SIZE 8
const struct device *uart= DEVICE_DT_GET(DT_NODELABEL(uart0));
static uint8_t tx_buf[] =   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07};
static uint8_t rx_buf[RECEIVE_BUFF_SIZE] = {0};
int main(void)
{
	int ret;
		if (!device_is_ready(uart)){
		printk("UART device not ready\r\n");
		return 1 ;
	}
	ret = uart_tx(uart, tx_buf, sizeof(tx_buf), SYS_FOREVER_MS);
	if (ret) {
		return 1;
	}
		ret = uart_rx_enable(uart ,rx_buf,sizeof rx_buf,RECEIVE_TIMEOUT);
	if (ret) {
		return 1;
	}
	while (1) {
		k_msleep(SLEEP_TIME_MS);
	}
}

Best Regards

    Tina

          

Parents
  • Hi Tina

    I think the issue here is that you're trying to communicate with the nRF7002 over UART, which is an interface the nRF7002 doesn't have. The serial protocols the nRF7002 supports is SPI and QSPI. Or are you using an nRF7002 DK that is connected to the STM32? Please explain what your end goal is properly.

    Best regards,

    Simon

Reply
  • Hi Tina

    I think the issue here is that you're trying to communicate with the nRF7002 over UART, which is an interface the nRF7002 doesn't have. The serial protocols the nRF7002 supports is SPI and QSPI. Or are you using an nRF7002 DK that is connected to the STM32? Please explain what your end goal is properly.

    Best regards,

    Simon

Children
  • Hi Simonr

               are you using an nRF7002 DK that is connected to the STM32?

    Yes, I am connect nRF7002 DK and STM32 for SPI,for SPI connect we need to send and recieved the big data application, for this application SPI already work.NOW I want to add UART for STM32, for UART protocol, I want to send and recieve command and small data application.

    isn't I need to add for device  tree ovelay "compatible" for STM32 UART(like SPI compatible)? for UART send and recieve will I need to add uart call back function for send and recieve ISR?

    Best Regards 

        Tina   

Related