cancel
Showing results for 
Search instead for 
Did you mean: 

Hints for detecting USART-input on tty - STM32F411CE* - weact* - Linux

timbo2023
Associate III

Given:

 

 

void USART2_Init (void)
{
	RCC->APB1ENR |= (1<<17);
	RCC->AHB1ENR |= (1<<0);
	GPIOA-> AFR[0] = (7<<8);
	GPIOA->MODER |= (1<<5);
	
	USART2->BRR = 0x0683;  // 9600 at 16MHz
	USART2->CR1 |= (1<<3);
	USART2->CR1 |= (1<<13);

}

void USART2_Write(int ch)
{
	while(!(USART2-> SR & (1<<7)));
	USART2->DR = (ch & 0xFF);	
	
}

 

 

 

No input data on /dev/tty* -

Are there hints/commands for generating input/later output data on tty* ?

 

Greetings

TIMBO

 

3 REPLIES 3

The number of people who are interested in debugging vague issues with uncommented register level code is very low.

Read the manuals, use a debugger, understand and explain the issue more carefully. Perhaps put a scope on the signals to confirm which end the problem is, your STM32 code, or your LINUX code/board.

void USART2_Init (void)
{
	RCC->AHB1ENR |= (1<<0); // GPIOAEN (do several cycles prior to usage)
	RCC->APB1ENR |= (1<<17); // USART2EN

	GPIOA->AFR[0] = (7<<8); // PA2:AF7
	GPIOA->MODER |= (2<<4); // PA2:AF MODE
	
	USART2->BRR = 0x0683;  // 9600 at 16MHz (16,000,000 / 9,600) OVER16
	USART2->CR1 |= (1<<3);  // TE - Transmit Enable
	USART2->CR1 |= (1<<13); // UE - UART Enable
}

void USART2_Write(int ch)
{
	while(!(USART2-> SR & (1<<7)));
	USART2->DR = (ch & 0xFF);		
}

Doesn't look unreasonable, but not highly invested.

What are you sending? When are you sending it? What are you observing on the wire?

Remember this is an adult technical venue, please try to present your problem with clarity and indication of what troubleshooting you've done, with observations.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
timbo2023
Associate III

In addition a question, how can I record the signal under my console in Linux?

No virtual driver - it could be set later.

 

It actually must possible to record data with the

cat /dev/tty  command ... something like this?!?

 

I just make my experiments with minicom.

I also tried /dev/bus/usb/**

 

Any hints for this purpose?

I'd imagine it could use cat and that you could open() and read() the /dev/tty directly in some C app you build, but this isn't a Linux forum, and no one here knows what board or distro of Linux you're actually working with or attaching this WeAct F411 board too, and to what end.

Do you work with/around people of a technical mind with whom you can discuss this stuff with?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..