Changing port assignment of Port 32A

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
eladmmor
Member++
Posts: 21
Joined: Tue May 01, 2012 1:58 pm

Changing port assignment of Port 32A

Post by eladmmor »

We are implmenting a version of the Audio 2.0 Refrence design on a XS1-L1 48-pin package.
Due to the different I/O pins in this on the 48-pin package, I have to change some of the port assignments of port 32A.
Looking at the header file - port32A.h:

Code: Select all

/* Bit defs */
#define P32A_USB_RST       0x01           /* ULPI rst line */  
#define P32A_COD_RST       0x02           /* Codec rst line */
#define P32A_CLK_SEL       0x04           /* MClk Select line */
#define P32A_LED_A         0x08           /* LED A */
#define P32A_LED_B         0x10           /* LED B */
Should I make the changes in the above file?
What is the meaning of the hex numbers defined?

Basically I want to move P32A_USB_RST from port X0D49 to X0D53
and P32A_CLK_SEL from port X0D51 to X0D52.

ThankS!!!


User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm

Post by Bianco »

Hi,

The hexadecimal numbers are the locations of the pins on the 32-bit port.
It is more convenient if you translate them into binary (on paper or in your mind):

Code: Select all

hex  binary
0x01 00000001
0x02 00000010
0x04 00000100
0x08 00001000
0x10 00010000
0x01 being bit 0 on the 32-bit port (P32A0), 0x02 being bit 1 (P32A1), 0x04 being bit 2 (P32A2) etcetera.

This should work for the pin swapping that you have in mind (confirm it yourself using the datasheet!):

Code: Select all

/* Bit defs */
#define P32A_USB_RST       0x10           /* ULPI rst line */ 
#define P32A_COD_RST       0x02           /* Codec rst line */
#define P32A_CLK_SEL       0x08           /* MClk Select line */
Note that i removed the two macro's for the position of the LEDs on the 32-bit port because they are overlapping the new assignments. You will have to declare new macro's for the LEDs on other pins on the 32-bit port or remove the code driving the LEDs (perhaps there is a macro to disable the LEDs).
User avatar
eladmmor
Member++
Posts: 21
Joined: Tue May 01, 2012 1:58 pm

Post by eladmmor »

Just wanted to thank you for your swift & accurate response. :)
User avatar
batb
Member++
Posts: 17
Joined: Wed Feb 01, 2012 5:19 pm

Post by batb »

Hi,
I have a similar need, I am using the XS1-L1-64LQ.

Changes on my design are:
USB reset on pin X0D2 (Port32A20),
LED A > X0D8 (Port32A26),
LED B > X0D9 (Port32A27).

I'm new to programming, please pardon me,
how does my code should look like?

Thank you in advance.
User avatar
batb
Member++
Posts: 17
Joined: Wed Feb 01, 2012 5:19 pm

Post by batb »

What I was figuring:

Code: Select all

/* Bit defs */
#define P32A_USB_RST       0x00100000           /* ULPI rst line */  
#define P32A_LED_A         0x04000000           /* LED A */
#define P32A_LED_B         0x08000000           /* LED B */

Is it correct?
User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm

Post by Bianco »

Looks correct
User avatar
batb
Member++
Posts: 17
Joined: Wed Feb 01, 2012 5:19 pm

Post by batb »

Thanks !
User avatar
batb
Member++
Posts: 17
Joined: Wed Feb 01, 2012 5:19 pm

Post by batb »

I'm not sure if it's working:
I am using a customised board very similar to the USB Audio RD,
except for the 64LQ C5 processor, the AT25DF041A flash, still natively supported,
and the newer USB3320 transceiver.
On it's datasheet, page 31, it is stated:
The link is not required to assert the RESETB pin. A pull-down resistor is not present on the RESETB pin, and therefore the Link must drive the RESETB pin to the desired state at all times (including system start-up) or connect the RESETB pin to VDDIO.
Effectively the USB3320 RESETB pin is normally low, and no 60MHz ULPI clock is visible on the
CLKOUT pin, which drives the XS1 as well.

Tying the RESETB pin to VDDIO lets the 60M clock to show up.

Unfortunately my XS1-LQ64 ULPI RESET pin (X0D2), port32A20 is always low.
How do I change this state to 'always high' ?
I hope this is the correct move!
Or would it be better to keep the RESETB and VDDIO pins tied together?

Any suggestion greatly appreciated!

Thanks in advance.