2024-12-19 11:31 AM
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
2024-12-19 12:35 PM
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.
2024-12-19 01:20 PM - edited 2024-12-19 01:26 PM
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?
2024-12-19 02:03 PM - edited 2024-12-19 02:04 PM
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?
2024-12-21 04:17 AM
You have to use usb to ttl converter and find it is connected to which /dev/ttyUSB. As an initial test connect tx and rx. In minicom chek if you get back your characters. It's lot easier in windows .
2024-12-23 12:11 PM
Bought from waveshare - I will try it again. Any hints for it?
But the function of the usb-c is not my ...
Have a nice day.
TIMBO
2024-12-23 01:03 PM
https://stm32-base.org/boards/STM32F411CEU6-WeAct-Black-Pill-V2.0.html
The board isn't going to inherently present as a USB CDC/VCP type device unless you've put some Arduino like loader on it, or compiled a USB CDC Device Example.
Inserted with BOOT0 HIGH it might present as a "STM32 BOOT" type device which is a DFU Device, and can be downloaded to via STM32 Cube Programmer.
For beginners I might suggest starting with a NUCLEO board as these include a built in debugger with a VCP and MSC device, allowing mapping of a UART on the Target and the drag-n-drop of a compiled binary directly.
Perhaps go find some specific example for the WeAct board that you can download with an ST-LINK