- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to read data coming into a shift register using DMA.
What pointer do I need to use as my DMA source to read whatever is currently in the shift register directly?
I can access the data that's been shifted in using ShiftReg_ReadRegValue() so I know the data has arrived correctly.
Thanks in advance
Dan
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dan,
If you look inside th ShiftReg_ReadRegValue() function you will see the the register being used: ShiftReg_OUT_FIFO_VAL_LSB_PTR
Use that along with HI16(CYDEV_PERIPH_BASE) as DMA_SRC_BASE
Len
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dan,
If you look inside th ShiftReg_ReadRegValue() function you will see the the register being used: ShiftReg_OUT_FIFO_VAL_LSB_PTR
Use that along with HI16(CYDEV_PERIPH_BASE) as DMA_SRC_BASE
Len
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Len,
Thanks for your reply.
I found that when I used ShiftReg_OUT_FIFO_VAL_LSB_PTR, i wasn't getting the behavior I was expecting... I found the same if I just read the FIFO directly using CY_GET_REG8.
Digging around in RegReadValue, could this be something to do with needing to trigger a capture??
In any case, it seems to wok if I use ShiftReg_SHIFT_REG_CAPTURE_PTR as the source instead. Maybe that's dangerous somehow, I don't know.. Any insight/warning would be welcome. I'm groping around in the dark here a bit
Another slight weird thing is that the first time I do a read, (whichever method i use) the first bit seems to get lost. If you debug the attached project, you can see the first byte (0xFF) comes out as 0x7F the first time around the loop. Subsequent reads seem to be correct. This isn't the end of the world for me, but slightly unnerving... Any further help would be appreciated
Thanks,
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dan,
If you look at the ShiftReg.c file you can see that:
ShiftReg_ReadData() - is very simple and reads the FIFO value.
ShiftReg_ReadRegValue() - is a blocking function waiting for the FIFO to be NOT EMPTY before reading the FIFO value.
I don't know why you are using the shift register and it's application. You can create your own shift register with direct access to the shift-register value using Status registers.
The ShiftReg v2.30 component uses the bShiftReg_v2.30 primitive. If you know have to read Verilog, you can decode the logic for this primitive.
Len
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your help, I've got it all sorted now