How can a clock be divided down?

Technical questions regarding the XTC tools and programming with XMOS.
babazaroni
Experienced Member
Posts: 94
Joined: Sun Feb 10, 2013 4:47 am

How can a clock be divided down?

Post by babazaroni »

Can clock blocks be configured or connected to divide an external clock signal?

I need to divide an external clock signal by 2 and 4 then clock some ports.
User avatar
Ross
Verified
XCore Legend
Posts: 1195
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

Sadly not, you would have do divide the clock in "software"
babazaroni
Experienced Member
Posts: 94
Joined: Sun Feb 10, 2013 4:47 am

Post by babazaroni »

OK, can a clock block be clocked by firmware?
User avatar
Ross
Verified
XCore Legend
Posts: 1195
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

Yes, a clock-block can be clocked by another port which is driven from software :)

Might be worth taking a look at the code in sc_i2s on github as it sounds like you have a similar configuration
babazaroni
Experienced Member
Posts: 94
Joined: Sun Feb 10, 2013 4:47 am

Post by babazaroni »

Thanks. Sounds like you have to use up a 1bit port though, which I'm trying to conserve.
User avatar
segher
XCore Expert
Posts: 844
Joined: Sun Jul 11, 2010 1:31 am

Post by segher »

For this you can use a 1-bit port that is not pinned out, too,
if that helps in your case?
babazaroni
Experienced Member
Posts: 94
Joined: Sun Feb 10, 2013 4:47 am

Post by babazaroni »

Thanks. That might be very useful.
babazaroni
Experienced Member
Posts: 94
Joined: Sun Feb 10, 2013 4:47 am

Post by babazaroni »

Looks like all unconnected ports are used by XUD.

Code: Select all

  #define PORT_USB_FLAG0       on USB_TILE: XS1_PORT_1N
  #define PORT_USB_FLAG1       on USB_TILE: XS1_PORT_1O
  #define PORT_USB_FLAG2       on USB_TILE: XS1_PORT_1P

  #if (XUD_SERIES_SUPPORT == XUD_U_SERIES)
    #define PORT_USB_CLK         on USB_TILE: XS1_PORT_1J
    #define PORT_USB_TXD         on USB_TILE: XS1_PORT_8A
    #define PORT_USB_RXD         on USB_TILE: XS1_PORT_8C
    #define PORT_USB_TX_READYOUT on USB_TILE: XS1_PORT_1K
    #define PORT_USB_TX_READYIN  on USB_TILE: XS1_PORT_1H
    #define PORT_USB_RX_READY    on USB_TILE: XS1_PORT_1M
  #else
    #define PORT_USB_CLK         on USB_TILE: XS1_PORT_1H
    #define PORT_USB_REG_WRITE   on USB_TILE: XS1_PORT_8C
    #define PORT_USB_REG_READ    on USB_TILE: XS1_PORT_8D
    #define PORT_USB_TXD         on USB_TILE: XS1_PORT_8A
    #define PORT_USB_RXD         on USB_TILE: XS1_PORT_8B
    #define PORT_USB_STP_SUS     on USB_TILE: XS1_PORT_1E
  #endif
User avatar
segher
XCore Expert
Posts: 844
Joined: Sun Jul 11, 2010 1:31 am

Post by segher »

You never told us what device you are using, so your claim
is hard to check ;-)

And yes the USB interface uses quite some ports. Just be
happy it isn't plain UTMI...
aiza11
Newbie
Posts: 1
Joined: Mon Oct 06, 2014 7:50 pm

Post by aiza11 »

BTW, I had a very quick look at this and got similar build errors. Enabling mixer is perfectly reasonable thing to do (as long as MIDI & SPDIF are disabled, otherwise you run out of cores).
My first thought is that there might be a bug since some of the XUD APIs look different.. Did you try any other versions? Which versions worked OK?