This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Piccolo SPI and XclkIN conflict

Other Parts Discussed in Thread: CC8520

Dear Tech:

I am designing a system using the Piccolo 28027, and want to use the SPI port, use the JTAG, and also use the XclkIN pin.

The issue is, If I use XclkIn on GPIO19, I cannot use that pin for SPISTE. If I use GPIO38 for XClkIn, there is a conflict with the JTAG.

I see some possible solutions:

1) use another pin for SPISTE, and handle it in software somehow (maybe an interrupt and faking out the SPI port.)

2) Use GPIO38 for XclkIN and have some kind of switch to remove my clock from GPIO38 when I attach the Jtag connector (how do I detect if there is a JTAG connected?)

3) write total bit banging code for handling SPI (maybe there is a library somewhere that has already done this?)

4) maybe, Could I use the X1 pin instead of the XclkIn? I don't know the internal circuitry for the internal osc, but it occurs to me maybe it can be driven by an external signal via a cap or resistor and think it is being driven by a crystal.

If there are some other solutions, please list them.

Can someone help with amplifying the solutions, and suggest the easiest alternative.

Thanks, Mark.

  • What are you looking to do with the external clock?  If you just need a high accuracy clock source, definitely go for a crystal on X1 and X2 instead of a canned oscillator supplying Xclkin.  Also note that the internal oscillator can get 1% accuracy if this is good enough for your application.

    As far as the JTAG, I guess you could use an external MUX controlled by TRST between an external clock and the JTAG clock.  This may be a little dangerous. If you don't need to automatically switch, you could put a jumper on the board to select between the two functions.   

  • I am designing a board with a Piccolo, and an Analog Devices ADAU1701 DSP. (I would have gone totally TI and used a codec, but the customer is the king.)

    For reasons too involved to get into here, there are two 1701's in the system.

    The 1701 requires it's system clock be synchronous with the serial digital audio bit clock, so, an external clock is needed to sync the two 1701's

    Also, we are using your CC8520 Wireless receiver and that has the potential of receiving 48KHz or 44.1KHz signals from it's transmitter. This can change dynamically.

    So, I will sometimes be getting the clock from the wireless, sometimes get the clock from yet another processor, or sometimes be generating the clock myself. This can change at any time.

    I have an on board oscillator.

    I have some multiplexers to switch clock source, and also gate the other clock source to the CAP pin so I can keep an eye on the relative difference between the two. (I need to know the current clock freq to calculate filter coefficients and such.)

    Mark.

  • Sounds like a really interesting product.  I definitely see your  problem though, and I am not sure if there is an easy/good solution.  What are your thoughts on using a jumper to switch between an external clock and the JTAG clock?   

    As best I can tell from the SPI module documentation, you are definitely going to need the SPISTE pin to use the module and you only have one mux choice for this pin.  

    Some other options:

    Bit-bang SPI: I can't seem to find any C28x specific code for this, but it should be possible.  We can try and figure out the most efficient way to do this if necessary.

    Use a low cost MSP430 as a SPI to UART bridge.  Take the external SPI communications on the MSP430 and send them directly to the SCI port on the C2000.  The lowest cost/size MSP430 with both SPI and UART looks to be about $0.60 and 20 pins.  You could use a smaller/cheaper MSP430 and bit bang one or both protocols.

    Upgrade to F2803x Piccolo.  Really easy, but adds cost.

    Can you continually update the internal oscillator trim based on readings of the known frequency clock on the CAP pin?

    I am still looking into the feasibility of driving a clock directly into the X1 pin.   

  • Thanks for your help Devin:

    I will be interested in any research you stumble across using the XI pin driven from some external clock.

    The MSP430 sounds like a solution. The one with the I2C and SPI and 1K Flash for 0.46 cents may work. It is an interesting option.

    I have been mulling over using a different pin for the SPISTE function.

    If I want to be a master, I can set another pin when I expect the Piccolo to use it's SPISTE, (the external world wouldn't know the difference,) then monitor the peripheral SPISTE and change the GPIO when it is done. As for receive, use an external interrupt on that GPIO and when it goes active... I guess it would be hard to get the SPI port to wake up at that point.

    Some experimentation may be in order. It might not be worth too much development cost to offset the 46cents of the MSP part.

    Mark.

  • Some follow up:

    You won't be able to use X1 as a clock input.  

    I also agree that if you are the master SPI you can emulate SPISTE pretty easily with a GPIO; just set the GPIO at the same time you initiate the write.  

  • Thanks for your research Devin.

    I am leaning toward using a different GPIO line for the SPISTE. I will mock up a breadboard and let you know how it goes later in the year.

    Mark.

  • Hello Mark,

    I am wondering whether your research about emulating another GPIO as SPISTE has been success or not.

    Can you post your research result?

    I need to connect F28027 SPI to 2 slaves, and in this case I want to know whether it is possible or not since there is only one SPISTE of F28027.

    Thanks in advanced.

    Best regards,

    Maria

  • Hi Maria:

    Unfortunately, my project got  put on the back burner.

    But, in my case, the XCLKIN issue turned out to be moot. I was connecting the Piccolo to 2 different Analog Devices 1701 processors, and was thinking the Piccolo needed to be clocked in sync with the 1701.

    I realized the 1701 can run totally asynchronously with the Piccolo and I decided to use the Piccolo's internal oscillators. I haven't really built a prototype yet, and beat frequencies may be an issue, but we will see.

    But it turns out the preferred method for talking to the 1701 is I2C, not SPI, so that problem turned out to be moot also.

    Sorry I couldn't be more help, but have you considered the following...

    Knowing nothing about your design, can you put a SPDT analog switch between the Piccolo SPISTE and the 2 peripherals, and control the switch with a GPIO line? That would allow the Piccolo to "look" at only one SPI peripheral at a time. With a multi pole switch, theoritaclly you could attach as many peripherals as you wanted. It is, however, an extra piece of hardware, but I think you can get those switches in single gate form and they are only, like, 6 pin.

    Another other choice is, if the Piccolo is always going to be the master, use some independent GPIO lines in place of the SPISTE and ignore the internal SPISTE in the Piccolo. I have not tested this, but do understand the protocol and it should work. You would set up the port, set one of your GPIO-SPISTE's, do the communication, then unset the GPIO-SPISTE.


    Good luck, Mark.