Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
DaGr_294516
Level 3
Level 3
10 sign-ins 10 questions asked First solution authored

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

0 Likes
1 Solution
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

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

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

4 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

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

Len
"Engineering is an Art. The Art of Compromise."
lock attach
Attachments are accessible only for community members.

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

0 Likes

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

Len
"Engineering is an Art. The Art of Compromise."

Thanks for your help, I've got it all sorted now

0 Likes