mborgerson
Well-known member
I am working on a project to generate gray-scale NTSC video using a 3-bit R2R ladder DAC on GPIOD bits 0 to 2. My plan is to use a large buffer of uint8_t to hold all the sync, porch, black and video levels and send them to GPIOD_PDOR one byte at a time.
I have two problems:
1. The buffer is 110,040 bytes long. It looks like the dmachannel object limits me to 32KB or less, even when there is no minor loop and the transfer size is 1byte. My first and second readings of the Kinetis manual and Kinetis.h seem to show that much larger transfers are possible when the minor loop is disabled:
#define DMA_TCD_NBYTES_MLOFFNO_NBYTES ((uint32_t)( & 0x3FFFFFFF)) // NBytes transfer count when minor loop disabled
With the t3.6 having 256K for my video frame buffer, it would be nice if dmachannel functions would support larger transfers when there is no minor loop. I will try direct operations on the TCD fields to see if they will work.
2. even with smaller test transfers, I get no output when I try to use the PDB to time transfers to my desired 6MHz clock rate.
Does using the PDB for periodic transfers require setting the TRIG bit (bit 6) of the channel configuration register? The triggerAtHardwareEvent method seems to set only the enable bit (bit 7).
I have had some success with this approach sending the output to DAC0, but the frame buffer is twice as large because the DAC needs 16-bit inputs. In Addition, the DAC isn't really fast enough to respond at 6MHz, so there is a lot of horizontal blur in the output.
I have two problems:
1. The buffer is 110,040 bytes long. It looks like the dmachannel object limits me to 32KB or less, even when there is no minor loop and the transfer size is 1byte. My first and second readings of the Kinetis manual and Kinetis.h seem to show that much larger transfers are possible when the minor loop is disabled:
#define DMA_TCD_NBYTES_MLOFFNO_NBYTES ((uint32_t)( & 0x3FFFFFFF)) // NBytes transfer count when minor loop disabled
With the t3.6 having 256K for my video frame buffer, it would be nice if dmachannel functions would support larger transfers when there is no minor loop. I will try direct operations on the TCD fields to see if they will work.
2. even with smaller test transfers, I get no output when I try to use the PDB to time transfers to my desired 6MHz clock rate.
Does using the PDB for periodic transfers require setting the TRIG bit (bit 6) of the channel configuration register? The triggerAtHardwareEvent method seems to set only the enable bit (bit 7).
I have had some success with this approach sending the output to DAC0, but the frame buffer is twice as large because the DAC needs 16-bit inputs. In Addition, the DAC isn't really fast enough to respond at 6MHz, so there is a lot of horizontal blur in the output.