debug output on uart[1]

mseerig
Posts: 8
Joined: Tue Feb 21, 2017 2:10 pm

debug output on uart[1]

Postby mseerig » Fri Jul 14, 2017 2:44 pm

Hi,
I am a little bit confused, why I have a debug output on my uart[1].
As far as I know, the generic debug output is at uart[0], right?
Is there a way to disable the debug output only at uart[1]?

Thank you in advance!

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

Re: debug output on uart[1]

Postby ESP_Sprite » Sat Jul 15, 2017 3:40 am

Which SDK/software/... are you referring to?

mseerig
Posts: 8
Joined: Tue Feb 21, 2017 2:10 pm

Re: debug output on uart[1]

Postby mseerig » Mon Jul 17, 2017 6:36 am

Oh, sorry! :D
I'm using the current esp-idf.

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

Re: debug output on uart[1]

Postby ESP_Sprite » Mon Jul 17, 2017 6:54 am

Erm, as far as I'm aware there should be no debug output on UART1, it's not even mapped to GPIOs by default if memory serves. What kinds of messages do you get, and how do you get at the output of that UART?

mseerig
Posts: 8
Joined: Tue Feb 21, 2017 2:10 pm

Re: debug output on uart[1]

Postby mseerig » Mon Jul 17, 2017 8:11 am

Ok, first of all, my uart routine is something like this: (please, don't be confused about my c++ code)

Code: Select all

UART_InitTypeDef uart_init;
uart_init.num = UART_NUM_1;
uart_init.baud_rate = 57600;
uart_init.data_bits = UART_DATA_8_BITS;
uart_init.parity = UART_PARITY_DISABLE;
uart_init.stop_bits = UART_STOP_BITS_1;
uart_init.flow_ctrl = UART_HW_FLOWCTRL_DISABLE;
uart_init.rx_flow_ctrl_thresh = 122;
uart_init.rts_pin = 0;
uart_init.cts_pin = 0;
uart_init.tx_pin = 16;
uart_init.rx_pin = 17;
uart_init.buffer_size = 1024;
UART uart(&uart_init);
FreeRTOS::sleep(1000); // need a delay for initialisation

ModbusMaster modbus(uart);
uint8_t* dat = new uint8_t[6];
modbus.build_query_basis(0x0001, 0x0004, 0x0003, 0x0001, dat);

uint8_t* inBuffer = (uint8_t*) malloc(1024);
for (;;) {
	modbus.send(dat, modbus.compute_response_length(dat)); // this is my data protocoll, wich I want to send
	while (!uart.available()) {     // waiting for uart interrupt
		FreeRTOS::sleep(100);
	}
	
	int len = uart.getBufferedLength();
	inBuffer = uart.read();	// read data (is correct an validated)
	
	printf("DATA>>"); // I can see this on my uart[1]
	for (int i = 0; i < len; i++)
		printf("%c", inBuffer[i]); // I can see this on my uart[1]
	printf("<<\n");  // I can see this on my uart[1] 
	
	FreeRTOS::sleep(1000);
}
In the attachments is my uart[1] output captured with my oscilloscope.

I hope everything is now clearly discribed, if not, I will try to answer soon! ;)
Attachments
oszi output.pdf
output of my oszi
(43.42 KiB) Downloaded 458 times

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: debug output on uart[1]

Postby WiFive » Mon Jul 17, 2017 9:46 am

What does UART constructor do?

You see all debug output on UART1 like bootloader, WiFi? Or just your printf?

mseerig
Posts: 8
Joined: Tue Feb 21, 2017 2:10 pm

Re: debug output on uart[1]

Postby mseerig » Mon Jul 17, 2017 12:37 pm

Yes, I see the whole debug output on my UART[1].
It starts with "(2264) cpu start: starting.)".. That is, what I can trigger. Unforchenetly, I don't know how to trigger more data in single mode...

Here is my UART init code:

Code: Select all

UART::UART(const UART_InitTypeDef* uart_conf) {
	//this->num = DEFAULT_UART_num;
	//this->buffer_size = DEFAULT_UART_buffer_size;

	this->num = uart_conf->num;
	this->buffer_size = uart_conf->buffer_size;
	this->err = ESP_OK;

	receiveBuffer = (uint8_t*) malloc(buffer_size);
	receiveBuffer_len = 0;

	uart_config_t uart_config;
	uart_config.baud_rate = uart_conf->baud_rate;
	uart_config.data_bits = uart_conf->data_bits;
	uart_config.parity = uart_conf->parity;
	uart_config.stop_bits = uart_conf->stop_bits;
	uart_config.flow_ctrl = uart_conf->flow_ctrl;
	uart_config.rx_flow_ctrl_thresh = uart_conf->rx_flow_ctrl_thresh;

	if (!UART_driverInstalled[num]) {

		sprintf(debugTag, "uart[%d]", (uint8_t) num);
		sprintf(_taskName, "%s_eventTask", debugTag);
		esp_log_level_set(debugTag, ESP_LOG_INFO);

		//Configure UART1 parameters
		uart_param_config(num, &uart_config);
		//Set UART pins
		uart_set_pin(num, uart_conf->tx_pin, uart_conf->rx_pin,
				uart_conf->rts_pin, uart_conf->cts_pin);

		uart_driver_install(num, buffer_size * 2, buffer_size * 2, 10,
				&uart_queue, 0);

		//Set uart pattern detect function.
		//uart_enable_pattern_det_intr(num, '+', 3, 10000, 10, 10);
		//Create a task to handler UART event from ISR
		xTaskCreatePinnedToCore(&uart_taskfunwrapper, _taskName, 2048, this, 12,
		NULL, 0);

		UART_driverInstalled[num] = true;
	}
}
I hope, that you can help me! :)

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: debug output on uart[1]

Postby WiFive » Mon Jul 17, 2017 10:22 pm


mseerig
Posts: 8
Joined: Tue Feb 21, 2017 2:10 pm

Re: debug output on uart[1]

Postby mseerig » Thu Jul 20, 2017 7:57 am

There is everything in standard settings:

CONFIG_CONSOLE_UART_DEFAULT=y
# CONFIG_CONSOLE_UART_CUSTOM is not set
# CONFIG_CONSOLE_UART_NONE is not set
CONFIG_CONSOLE_UART_NUM=0
CONFIG_CONSOLE_UART_BAUDRATE=115200

Who is online

Users browsing this forum: No registered users and 125 guests