Setting two different baud rates in AVR USART - avr

I need to set baud rate of USART to 9600 to receive data from PC. Then I need to change it to 300 to send data to other device. Can AVR work with different baud rate ?

Can AVR work with different baud rate ?
If the controller has multiple USART ports, each can run at a different baud rate.
You can also change the baud rate for each port at any time. Technically there are some minor pitfalls like changing speed while a transmission is ongoing may corrupt data.

Related

High UDP communication latency because of audio rendering (Windows, C++)

I am trying to communicate with an external robot at 1 kHz using UDP protocol with WinSocket library. I am using Windows 10 Pro Version 21H2. In the hardware side, I use a pc with intel core i9 10900X 32 GB RAM and Intel I219.
At a certain point it work pretty well, I did measure the time spent for the communication (both sending and receiving the packets sequentially takes between 200 microseconds and 500 microseconds), and I did also measure using wireshark the number of packets exchanged (1000 packets sent per second and 1000 packets received per second too). The throughput sending is 2 Mbps and receiving is 3Mbps.
The issue start when any audio is rendered (even the sound happening when changing the volume on windows), this lead to a noticeable latency (about 10 to 15 milliseconds).
When I stop the Windows Audio Service, this solves the issue but in our application, we need to render a sound permanently.
graph : round trip time and frequency vs index of udp query, using NIC PCI
A temporary solution was to use a USB/Ethernet adapter instead of NICs. Using this type of device we have no latency but we already experienced in the past some issues related to drops of performance due to thermal throttling.
graph : round trip time and frequency vs index of udp query, using USB/Ethernet adapter
I also did try to reduce the audio process priority, no difference. I also tried to set the affinity mask of the audio service in different threads than my application, no difference neither.
My questions : is there a way to increase the audio latency in order to prioritize the udp communication or to reduce the latency of the udp communication to meet our need of 1 kHz frequency.
This problem is due to the Receive Side Throttle feature some NICs support.
In order to fix it, you need to set the register variable
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\NetworkThrottlingIndex to 0xffffffff and reboot windows.
This registry key is private and internal to Windows OS, it is not supposed to be used publicly and it's not officially supported by Microsoft.

Raspberry Pi GPIO: Hardware Timing (e.g. Interrupts)

I've been trying to find any way to do hardware timing control on the Raspberry Pi but have been unable to find anything.
I need to be able to generate stable timing over the GPIO pins on the RasPi (e.g. to communicate with an FPGA at high-bandwidths) and need upwards of a 10-100MHz clock on the GPIO pins.
Everything I've seen so far uses delays to achieve timing, which is a really bad way of doing timing. For one, you don't get timing guarantees and get clock jitter; on top of this, I can't get a 10-100 MHz clock uwith usleep.
How do I get an interrupt or some other hardware-controlled timing for GPIO?

Auto detect UART baud rate of a working device

I have a device which is continuously sending data through UART.
I'm trying to read it using a terminal application on Windows-based PC. The problem is that I don't know at which baud rate the device is sending the data.
The data I'm getting at higher baud rates doesn't make any sense so I have narrowed it down to lesser than or equal to 600 among the standard baud rates available on terminal.
Is there any software to detect the baud rate or a method using any microcontroller??
No, not if you want to get done quickly. Ten years doing this type of task says an oscilloscope or even an inexpensive USB-based logic analyzer is your best solution here. This isn't a software problem yet, it's a signal detection problem. You should be able to clear this up in a few minutes with the right instrument.
I'm assuming you're only doing this exercise because the transmitting part is one for which you cannot find a datasheet. If you had a datasheet in hand, that would clear this up, or at least suggest the possible baud rates you should try.
I tried Realterm software and found out that the data is coming at 300 Baud Rate, no parity, 8 data bits and 1 or 2 stop bits. For the remaining options, I get Framing error and break condition in the software. Thank you all...
Old thread but I thought it might be useful.
Something I did was write a python/pyserial script that kept cycling through different baud rates (300 - 115200) and listened and filtered for strings that aren't garbage. Something that decides easily, with the assumption that but would be good clear text so you have the right rate.
It worked well enough and seemed to find the right rate more than fast enough to esc into the bootloader of my AP.

SPI Module with SCK same as SPI Module Clock - VHDL

Since I see only SPI modules that have an input clock of 2xSCK I want to ask if it's possible to realize an SPI module that have an SCK of same frequency as SPI module.
Depending on whether you are the SPI master or slave, you may be able to come up with something, but the best solution would be to simply increase your clock rate. If your hardware supports them you can use DDR (double data rate) input or output registers to register inputs or drive outputs on both clock edges. If you're the slave you can assign the SPI clock as a clock input, and latch the data using the incoming clock edge. However you will then have to cross clock domains inside your logic.
I would highly recommend increasing your logic clock rate if at all possible.
Having input clock >= 2×SCK is a physical boundary. It's called the Nyquist rate.
Have a look for Shannons sampling theorem.

connecting avr atmega32 to shift register using USART?

I want to connect ATMEGA32 microcontroller to a shift register using USART via TXD pin, the shift register then performs serial to parallel conversion on the received data. but as you know, the shift register needs clocking , this clocking is fed via the microcontroller at baud rate frequency via XCK pin (here the USART acts as master synchronous clock generator).
My problem is that i don't know how to get these clock signal out of XCK, so how to do that???
thanks
RS-232 is self-clocking (fix baud rate) - it typically uses x16 clock supplied to a UART which syncs to the incoming data start bit edge. Rather than use a bare shift register you would probably be better off just using a simple UART chip as your serial to parallel converter - it would save a lot of effort.
I don't think using the UART for the shift register would be a good idea. It would be better to use the SPI mode of communication as it also provide the clock you require for the shift register. But if you want to use UART then you would have to provide a separate clk in sync with the baud rate you've selected for the UART mode which I think would be very hard and inaccurate.

Resources