- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm doing a silly project where i have an array of random numbers and i would like to transfer each element of the array to the GPIO Port 1 with DMA, each transfer must be done when the user on-board button is pressed.
The DMA component is configured to transfer Byte -> Word, incrementing the source one element after each transfer.
I thought the following line will make the project run, but it seems like it does not:
DMA_Start((void *)array, (void *)Pins_DR);
Any thoughts?
I'm mostly new to PSoC 4 DMA so maybe there's a obvious mistake. I'm using the CY8CKIT-043 board.
Project is attached. thanks in advance
Carlos
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Two things I see at first glance:
DMA_Start((void *)array, (void *)(&Pins_DR)); // You need the address ao Pins_DR !!
and in DMA component you need to specify Number of data elements to transfer as 25 or however the size of your array is.
You should additionally think about what to do when all the bytes are transferred.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bob,
Yep, i forgot to set the number of data elements to transfer and didn't know i had to place the & operand on the second parameter, already did a project with DMA that seems it's working and i didn't use & on both parameters.
Is there a way to specify with the DMA GUI configuration window that i want to do a loop over the td0 when it's completed? I only found a API (x_SetNextDescriptor()), but it seems to do a loop 'by default'.
Will read the port with a logic analyzer and see if the array elements are sent correctly.
Attached is the project working.
Thanks for the help Bob 😄
Carlos
EDIT
The debugger don't seem to refresh automatically every time a register changes, i had to play the program, push the button, pause the program and see how the register changed.
Automatic refresh will be fixed, or it's already available?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can set a breakpoint on a register change (you need to dig a bit for its address).
An automatic refresh is not possible: the transfer would need the CPU whic of course would disturb the normal program flow.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Damn, long time, sorry for the late reply, i did not get the notification ;(
Thanks odissey, i will check the project right now! i will have to port it to work on PSoC4M tho.
Thanks for the help Bob, don't know what this forum would do without your help 🙂
Carlos
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So now it kind of works as i want, but i was expecting to transfer just 1 byte from the memory array every time is a rising edge of the Timer_tc (see image), and as you can see the 5 bytes of the array are transferred, then the DMA_Interrupt gets triggered, this is when the data is fully transferred.
On the image b0 = 2.0, b1 = 2.1 and so on, my LA is only 8 channels so could not attach more signals (it's midnight and i'm lazy to find the other 2 wires xD).
Any thoughts?
Thanks in advance, the current project is attached :), done in Creator 4.0
Carlos
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great illustrator!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi oddisey,
Thanks for the help, checking your projects and reading the DMA datasheet i realized the pulse parameter must be set to unknown, this will only trigger the DMA transaction on the rising edge on tr_in input, other parameters will trigger the DMA continually.
So i think finally the project is working nicely, below the logic analyzer capture 🙂 (sorry for the letter i was writing with the pc mouse xD)
Thanks a lot, the project is attached.
Carlos