Reply
Posts: 6
Registered: ‎04-17-2017
Accepted Solution

CP2130 - Set slave registers on power-up

Good morning!

 

This is my first post here, and I have what I think is a fairly unusual question. I'm in the planning stages for a small board that uses a signal processing chip that only uses SPI; this board will be an accessory for an existing design that does NOT have SPI capability, so I was delighted to find the CP2130. My delight was significantly tempered when I learned the configuring registers in the primary chip for this little board are completely volatile - they have to be set by the controlling processor everytime the device is powered off and on! Since my main controller doesn't do SPI, this configuring would have to be done via USB and a laptop - Every. Single. Time. This is unacceptable, and puts a real crimp in my plans.

 

Now. We're not talking the Library of Congress here, but rather a mere 5 bytes. These aren't even 'address and data' combinations, but simply discrete instructions that are loaded and stored immediately upon receipt. I'm *hoping* that the CP2130 can be set to automatically transmit these 5 bytes on power-up, perhaps from the one-time ROM, perhaps with a half-second delay to ensure the slave is up and running first.

 

Thoughts? Comments? Is this possible, or is this little project done like dinner?

Posts: 2,801
Registered: ‎02-07-2002

Re: CP2130 - Set slave registers on power-up

I do not quite follow. As I understand it you want to make a small board with a signal processing chip and a CP2130. And this board should be connected to an existing design using USB.

- You talk about 5 bytes of configuration data but is this for the CP2130 or for the signal processor?

- And after that you don't need the USB-SPI function anymore?

- Does the 'existing design' have USB?

- What about using a small MCU to send those 5 bytes over SPI?

Posts: 6
Registered: ‎04-17-2017

Re: CP2130 - Set slave registers on power-up

The signal processor can ONLY be configured by SPI, and has to be reconfigured every time the unit is turned on.As far as I'm concerned this is a significant design flaw, but this is the ONLY chip of its kind that I have been able to identify.

 

The current design can use UART or CAN; the signal processor output to the current design would be by 0-5v analogue signal.

 

The 5 bytes of configuration data are for the signal chip. If those 5 bytes can be held by the CP2130, and if it could be transmitted on power-up, this would allow the card to work. That said, I just realised that once the CP2130 ROM is programmed with those 5 bytes, that's it, no more tuning. *sigh*

 

The CP2130 would be retained on the accessory card to allow the end user to configure and tune the accessory card using a laptop. I thought about a small uC that would have no function except to hold these 5 bytes and load them into the signal chip, but I'd still need a USB-UART or USB-SPI bridge to adjust the settings held in the uC.

Posts: 2,801
Registered: ‎02-07-2002

Re: CP2130 - Set slave registers on power-up

I would put the smallest MCU with a UART (with or without SPI) on your accessory board to send those 5 bytes at power up. If it has no SPI then just bit-bang it as a SPI master is pretty simple. Then use a USB-UART cable to adjust the settings. Or if you really want USB on the board, consider an MCU with USB (instead of the UART). But you could also choose to use the MCU's programmer to upload the new settings so you don't even need the UART.

 

But I really don't think the CP2130 can send a fixed message at power up.

Posts: 6
Registered: ‎04-17-2017

Re: CP2130 - Set slave registers on power-up

*nods* I've been doing some research the past day or so on that very topic, and Atmel has some interesting App Notes. There are AVR sample source codes in those ANs for bit-banging SPI and UART, and they're small enough to fit in a SOIC-8 ATtiny. The current plan is that the 5 configuration bytes are stored in EEPROM, then sent to the signal processor on power up via SPI, at which point the ATtiny will go into power-down sleep mode.

 

If a particular pin is grounded, it wakes up, accepts new bytes via UART, loads them into EEPROM, and refreshes the signal chip by SPI. Once the grounding signal is removed, it goes back to sleep.

 

There are SOT23-6 versions of the ATtinys, but I don't think four pins are enough - three for SPI, one for wake-up, one for RX, one for TX to cofirm what was received. It would be funny in a silly sort of way, though, using such a tiny little thing. Hmmm - ground signal wakes it, RX & TX for new info. Once the wake-up call is removed, it refreshes the signal processor via SPI, then goes back to sleep ...

 

Thanks for your comments and advice!

Posts: 1,728
Registered: ‎10-14-2014

Re: CP2130 - Set slave registers on power-up

Yes, I agree with @vanmierlo, the CP2130 is a bridge product and it only send the message when host asked it. I never heard that it could be customized to meet your requirement.

 

If the USB MCU is an acceptable option you could consider the MCU that support USB function from Silabs, like 8-bit EFM8UB1/EFM8UB2 and 32-bit EFM32LG/GG/WG.

 

My views are my own and do not necessarily represent the views of Silicon Labs

 

 

WeiguoLu
Posts: 2,801
Registered: ‎02-07-2002

Re: CP2130 - Set slave registers on power-up

I advise against using a bit-banged UART. And if current consumption is an issue, have a look at the SiLabs EFM8 Sleepy Bee. It has UART and SPI, can sleep very deep, and can be as small as 3mm².

 

Further, I expect your SPI device to also require a /CS pin from the MCU. So unless the dataline is bidirectional you'll need 4 lines.

Posts: 6
Registered: ‎04-17-2017

Re: CP2130 - Set slave registers on power-up

I'm vaguely aware of some of the issues with bit-banged UART, but 5 bytes typed by a human then returned in a few millisec en masse, vs the typical dataload of a real UART connection, doesn't leave much opportunity for confusion. I'll take another look at my options, though.

 

As to the SPI, since this is a single-slave operation the /SS or /CS pin could simply be grounded. Having just said that, however, the notion tweaks at my brain that these are *commands*, not just a batch data load, so a distinct "data ends - do it!" declaration might not be a bad idea (the datasheet doesn't comment either way). The suggestion of the 6-pin variant was pretty much tongue-in-cheek; for something using mashed-up code by someone who understands just enough code to be dangerous (I'm a hardware guy, and my company is a one-man show), single-use pins are probably a good idea. Aaand that brings us back to your point about avoiding bit-banged UART. *laugh*

 

Good advice - thanks!

Posts: 6
Registered: ‎04-17-2017

Re: CP2130 - Set slave registers on power-up


delu wrote:

Yes, I agree with @vanmierlo, the CP2130 is a bridge product and it only send the message when host asked it. I never heard that it could be customized to meet your requirement.

 


It was a faint hope; it would have offered everything I needed in one neat little package. *sigh*

 

Thanks for the confirmation though; you and vanmierlo have prevented a waste of time, effort and money.

Posts: 2,801
Registered: ‎02-07-2002

Re: CP2130 - Set slave registers on power-up

Usually the /SS also resets the SPI statemachine, so you know at what bit it starts after asserting it.

 

And the reason why bitbanged UART is difficult is because the MCU is not the master of the interface who can decide when to listen and when not. It must always be ready to receive an incoming character.

 

About the CP2130, I think it is an EFM8 Universal Bee (or one of its predecessors) with fixed firmware. So you can have everything you want in one little package if you choose a EFM8 Universal Bee or EFM32 Happy Gecko as WeiguoLu mentioned (no need for LG/GG/WG), but then you must also handle the USB connection in your software.

Highlighted
Posts: 6
Registered: ‎04-17-2017

Re: CP2130 - Set slave registers on power-up

Sometimes, I really do over-think things ... I have a signal chip that only uses SPI, a uC that can easily be taught to speak SPI, and - the device that brought me here in the first place - a USB/SPI bridge. So WHY am I even thinking about UART?? *bonk*

 

Thanks, guys; I think we can call this one sorted out. Greatly appreciated!