Post Go back to editing

ADuCM363 DMA documentation error

Category: Datasheet/Specs
Product Number: ADuCM363
EngineerZone is sticking this in the 8052 forum. It should really be in the ultra-low power forum.
While trying to get DMA working on a ADuCM363, I have noticed some documentation errors. These are found in Rev B of the ADuCM362-ADuCM363 Hardware reference manual.
Page 61 of the document, states there are 16 DMA channels and lists them.
Page 68 of the manual lists the reset value of the DMASTA register, 0x000B0000, which would correspond to a CHNLSMINUS1 value of 11 which is 12 DMA channels. However, the actual reset value of the DMASTA register, when viewed through a debugger, is 0x00110000, which corresponds to 18 channels!
Page 69 documents the DMAPDBPTR register and says, "Note that 5 + log(2)M LSBs are reserved and must be written 0, where M is the number of channels."
We will assume that log(2) rounds up if the value is not an integer. If we use the documented value of 16 channels, we get "5 + log(2)16" which is "5 + 4" which is 9. 9 LSBs of zero give us an alignment factor of 0x200. However, if you try to assign a DMAPDBPTR value of 0x20001200, which has the 9 LSB's of 0, the register adjusts the value to 0x20001000!
If we instead assume that the CHNLSMINUS1 value in DMASTA, as read in the debugger, is correct and the device really has 18 DMA channels, then our "5 + log(2)M" calculation becomes "5 + log(2)18" which is "5 + 5" which is 10. 10 LSBs gives an alignment requirement of 0x400. And that, in fact, is the correct value to use. If the Primary Control Data Base pointer is 0x20001400, the DMAPDBPTR register does not modify it.
So, at the very least, the Hardware Reference Manual is incorrect. Both in claiming that CHNLSMINUS1 is 11 (12 channels) and also that the device only has 16 DMA channels, when in fact there are 18.   What are the 2 missing DMA channels? Are they just unassigned?
Also, the example code in ADuCM36x_DFP.1.0.4 defines DMACHAN_DSC_ALIGN as 0x200 (Device/Include/drivers/DmaLib.h). This is incorrect. It should be 0x400. If the example code works (I haven't tested it), it is only by luck.

Thread Notes

  • This actually gets a bit worse. The DMAADBPTR is a read-only register. Its value is automatically set based on the value placed in DMAPDBPTR. The manual shows a reset value of DMAADBPTR that is 0x100 larger than DMAPDBPTR.

    This is incorrect. It is actually 0x200 higher. 0x100 would work perfectly if there were only 16 DMA channels, but if there are 18, you need more than the 256 bytes, so it gets rounded up to the next power-of-two - 512.

    This also means code like this (where NUM_CHAN is 16 and sizeof(struct dma_chan_ctrl) is 16 bytes) won't work.

    #pragma data_alignment=0x400
    static struct dma_chan_ctrl DMAPriChanCtrl[NUM_CHAN];
    static struct dma_chan_ctrl DMAAltChanCtrl[NUM_CHAN];

    There needs to be a gap between the Primary and Alternate channel control arrays. It's a shame that DMAADBPTR is read-only. If it could be assigned, it would make placement of the arrays easier. Since it is not assignable, we have to play linker games to get the alternate array placed correctly relative to the primary array (and hopefully make the gap between the two arrays available for other variables).

  • Hi,

    Can you please download the drivers and examples for the ADuCM363 from the ADuCM362/ADuCM363 Evaluation Software link in ADUCM363 Datasheet and Product Info | Analog Devices?

    These drivers have the correct alignment for the ADuCM363 DMA.

    I can also confirm that only 16 channels of the DMA are assigned.

    Regards,

    Raquel.

  • Hi Raquel,

    Thank you for your reply. I'm not using Analog's drivers. I'm writing my own, so the source isn't directly helpful. However, looking at it, I see the extra two DMA channels are for UART2, which isn't present on the ADuCM362/ADuCM363. (There is also an interrupt vector reserved for UART2.)

    Since the driver code is aware of the 18 DMA channels (of which 16 are used) issue, it stands to reason there is an erratum for the documentation discrepancy. Where can I find this and any other errata for the microcontroller?