Using DMA to read UART0 in problems
Posted: Thu Aug 01, 2024 10:54 am
Right now, I'm attempting to read a sizable amount of data from UART0. I can read all the data as expected in simple polling mode, directly on the UART data + flag registers. But the DMA engine copies extra zeroes for every byte when I try to use it to achieve the same result. As an illustration, suppose I get the bytes
Code: Select All
when the values in memory are 0x12, 0x34, 0x56, 0x78, etc.
Code: Select all
120000000, 340000000, 560000000,0x78000000, etc.
if the DMA transfer lasts long enough (I assume this is because it copies the extra zeroes, as it appears to truncate the entire transmitted bytes). Upon closer inspection, it appears that these additional zeroes result from copying the whole 32-bit data register from the UART rather than just the low byte containing the data. Right now, my transfers are configured to move N bytes from the data register address of the UART peripheral to a memory buffer, with destination increment enabled, source DREQ enabled, and source increment disabled. Is it possible to make the DMA engine read one byte at a time in fixed-source mode ?
Code: Select All
when the values in memory are 0x12, 0x34, 0x56, 0x78, etc.
Code: Select all
120000000, 340000000, 560000000,0x78000000, etc.
if the DMA transfer lasts long enough (I assume this is because it copies the extra zeroes, as it appears to truncate the entire transmitted bytes). Upon closer inspection, it appears that these additional zeroes result from copying the whole 32-bit data register from the UART rather than just the low byte containing the data. Right now, my transfers are configured to move N bytes from the data register address of the UART peripheral to a memory buffer, with destination increment enabled, source DREQ enabled, and source increment disabled. Is it possible to make the DMA engine read one byte at a time in fixed-source mode ?