I'm stumbling over what I think is a bug in Teesny4 DMAChannel.h. When attempting to do 16 bytes, then this code (from 1.59.0 core) puts value 4 (0100b) into SSIZE and DSIZE fields. But those are "Reserved" and "Using a reserved value causes a configuration error.".
Should it not be a case for len==8 with 0x0303 in these fields?
From the reference manual:
Should it not be a case for len==8 with 0x0303 in these fields?
Code:
/*************************************************/
/** Quantity of Data to Transfer **/
/*************************************************/
// Set the data size used for each triggered transfer
void transferSize(unsigned int len) {
if (len == 16) {
TCD->NBYTES = 16;
if (TCD->SOFF != 0) TCD->SOFF = 16;
if (TCD->DOFF != 0) TCD->DOFF = 16;
TCD->ATTR = (TCD->ATTR & 0xF8F8) | 0x0404;
} else if (len == 4) {
TCD->NBYTES = 4;
if (TCD->SOFF != 0) TCD->SOFF = 4;
if (TCD->DOFF != 0) TCD->DOFF = 4;
TCD->ATTR = (TCD->ATTR & 0xF8F8) | 0x0202;
} else if (len == 2) {
TCD->NBYTES = 2;
if (TCD->SOFF != 0) TCD->SOFF = 2;
if (TCD->DOFF != 0) TCD->DOFF = 2;
TCD->ATTR = (TCD->ATTR & 0xF8F8) | 0x0101;
} else {
TCD->NBYTES = 1;
if (TCD->SOFF != 0) TCD->SOFF = 1;
if (TCD->DOFF != 0) TCD->DOFF = 1;
TCD->ATTR = TCD->ATTR & 0xF8F8;
}
}
From the reference manual: