UART Problem on GPIO 32 / 33

kacie_23
Posts: 5
Joined: Fri Nov 22, 2019 7:21 pm

UART Problem on GPIO 32 / 33

Postby kacie_23 » Mon Jan 20, 2020 12:39 pm

Hello,

I just tried to implement a GPS communication on GPIO 32/33 TX/RX. (pin 8 and pin 9 on wroom32).

I can see on my oscilloscope that writing on GPIO32 / TX works, indicating that the uart init (UART_NUM_1) have succeded.
I am also getting a lot of data on the input, by looking at the oscilloscope.

But when I try to do this :

Code: Select all

	uint8_t *data = (uint8_t *) malloc(RF_RECEIVER_BUF_SIZE);
	int len = uart_read_bytes(UART_Masterport, data, RF_RECEIVER_BUF_SIZE, (timeout < 0 ? ticksToWait : pdMS_TO_TICKS(timeout)));

    	printf("Output %d bytes: %s",len, (const char*)data);
Length is zero, and just garbage from the buffer.

Do I have to configure the GPIO in some way, or will the UART init process do this?

ESP_Sprite
Posts: 3131
Joined: Thu Nov 26, 2015 4:08 am

Re: UART Problem on GPIO 32 / 33

Postby ESP_Sprite » Tue Jan 21, 2020 9:14 am

Normally the UART init process will do that. Also wrt garbage: if len is 0, the buffer output is undefined (but most likely whatever was in the memory region before malloc() allocated it)

Who is online

Users browsing this forum: Google [Bot], mikronauts and 18 guests