How to access UOTGHS (USB) pipe DPRAM

Discussion around product based on ARM Cortex M3 core.

Moderators: nferre, ncollot

Bogdancev
Posts: 9
Joined: Sun Jul 13, 2014 3:13 pm

How to access UOTGHS (USB) pipe DPRAM

Sat Oct 04, 2014 1:36 pm

Hello Everybody

SAM3X based board.

It seems there is no information how to get access to UOTGHS pipe memory area in DPRAM. In ASF example I found a macros:

Code: Select all

#define UHD_PIPE_MAX_TRANS 0x8000
#define uhd_get_pipe_fifo_access(p, scale) /
(((volatile TPASTE2(U, scale) (*)[UHD_PIPE_MAX_TRANS / ((scale) / 8)])UOTGHS_RAM_ADDR)[(p)])
And usage is:

Code: Select all

uint8_t *ptrReceiveBuffer = (uint8_t *)&uhd_get_pipe_fifo_access(0, 8);
Could someone explain what that macros does or is there another simpler way to understand how to get access to pipe FIFO bank?

Regards, Sergiy
nutsnbolts
Posts: 31
Joined: Mon Aug 25, 2014 11:20 pm

Re: How to access UOTGHS (USB) pipe DPRAM

Sat Oct 04, 2014 5:57 pm

Once again, welcome to the world of ASF!
Look at
...\src\ASF\sam\utils\preprocessor\tpaste.h(83):

See also ... \src\ASF\sam\drivers\udphs\udphs_device.h(659)
(My project is a device only, but you'll have an equivalent for the above) 

-line numbers (in brackets) are for my project- yours may differ.
USB DPRAM is accessed by the dedicated USB DMA- maybe a clue there?
In Atmel Studio6, you can right click on a function, and "Go to Implementation"- write down where you are on paper (file name, line number)- there's no "back" button! It'll also help you make some sense of the program's flow.
Alternatively, highlight the function's name, Edit->Find & Replace->Find in Files will (usually!) come up with all occurrences in a list you can step through.
Best Wishes,
Mike.
Bogdancev
Posts: 9
Joined: Sun Jul 13, 2014 3:13 pm

Re: How to access UOTGHS (USB) pipe DPRAM

Sat Oct 04, 2014 7:32 pm

Thanx Mike again.

I think my problem here was that I did not know what means ## in C (as I'm being a C# era developer).

It just converts type to U8 which is uint8_t. Now I'll try to decipher it further.

Regards, Sergiy
ahgu
Posts: 72
Joined: Tue Jun 14, 2005 7:49 am

Re: How to access UOTGHS (USB) pipe DPRAM

Sun Nov 16, 2014 8:20 am

Did you figure out the dpram mapping for uotghs?
Datasheet very unclear.
ahgu
Posts: 72
Joined: Tue Jun 14, 2005 7:49 am

Re: How to access UOTGHS (USB) pipe DPRAM

Sun Nov 16, 2014 4:41 pm

(((volatile TPASTE2(U, scale) (*)[UHD_PIPE_MAX_TRANS / ((scale) / 8)])UOTGHS_RAM_ADDR)[(p)])

getting error while compiling. Not making any sense. 
I suspect it is adding 512*ep to UOTGHS_RAM_ADDR. 

NEED a DOCUMENT on this, what is the difference between the udphs and otghs?
totally different USB hardware implementation?

Return to “SAM3 Cortex-M3 MCU”

Who is online

Users browsing this forum: Google [Bot] and 1 guest