Go Down

Topic: Can I use Arduino for serial communication with this microcontroller? (Read 395 times) previous topic - next topic

soundbender123

Hi,

I'm a coder who wants to control any accessible parameter on the anti-shock memory controller SM5859AF using serial communication from an arduino for sound purposes.

It's data sheet is here

There are several pins relating to serial data, and wanted to know the feasibility of controlling any parameters, and if so, what parameters could I change.

Any advice would be much appreciated.

Thanks in advance.

GoForSmoke

It's a SAM cortex so expect 3.3V or less operation. You will need voltage leveling to not smoke your SAM pins. There's lots of ways to do that but check out the 74HC4050 hex buffer made for 5V-3.3V work. Shop around, you can get a few for 50 cents or less (I paid 35 cents ea for 10 or so), they have 6 channels that you wire 5V to 3V on a 16 pin chip that you can wire a resistor and a diode per channel to replace instead but it ill take more board space. Be sure to get the DIP version unless you surface mount your own chips.

Example is 5V Arduino to 3.3V SD card. The Arduino OUTPUTS on SCLK, MOSI and SEL pins, those lines need leveling. The SD also needs at least 100mA capable 3.3V as 80mA surges are known. The MISO line is 3.3V OUTPUT, it can connect directly to the Arduino MISO pin and flip the bit just fine. And be sure to connect the grounds.

The resistor and diode leveling is pretty keen. You put a diode between 5V OUTPUTs and 3V INPUTs to block 5V to 3V flow and then you supply the 3V side through a 4.7K resistor. When the 5V pin is LOW, the 3V pullup gets drained through the diode and the 3V device reads LOW. When the 5V pin is HIGH, the 3V device reads the pullup HIGH. This beats power-wasting voltage dividers.

Note that a single 74HC4050 can level 2 SPI devices with 3 channels each.
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

PaulRB

The supply voltage range for the chip is 2.7 to 5.5V. Can you choose the supply voltage in your circuit, or is that already determined by other parts of the circuit? If you can choose, go for either 3.3V or 5V and choose an Arduino that uses the same supply voltage so that the level conversion issues that GoForSmoke talks about are not a problem.

Which Arduino you use will depend on the supply voltage and what other tasks the Arduino will need to perform.

As for which parameters in the chip you will be able to alter... well, all of them that are mentioned in the data sheet. That's why they are mentioned in the data sheet. Perhaps I don't understand your question?

GoForSmoke

Arduino won't run 16MHz on less rhan 4.5V, if that's a concern. 8MHz is plenty fast for most uses.
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

soundbender123

Thank you GoForSmoke and PaulRB for all this great information.

I have a follow up question regarding clock speed and supply voltage requirements…
 
I'm trying to control the skipping-type behavior of this chip in a Sony Discman (while a CD is playing), which runs at 4.5v. I understand the chip's system clock is 16mzh but do my communication signals have to be at the system clock speed?

Thanks again
 

MorganS

"The problem is in the code you didn't post."

GoForSmoke

Thank you GoForSmoke and PaulRB for all this great information.

I have a follow up question regarding clock speed and supply voltage requirements…
 
I'm trying to control the skipping-type behavior of this chip in a Sony Discman (while a CD is playing), which runs at 4.5v. I understand the chip's system clock is 16mzh but do my communication signals have to be at the system clock speed?

Thanks again
 
I'd be looking to the disc and if the Sony is old then the laser as problem sources long before "the chip".
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

PaulRB

No, they have to be at the correct serial baud rate.
It looked to me as I glanced through the data sheet that the interface is SPI. So the master device (the Arduino) determines the SPI clock speed and it does not matter what clock speed the slave device is running at (as long as the slave's maximum SPI speed is not exceeded).

soundbender123

I'd be looking to the disc and if the Sony is old then the laser as problem sources long before "the chip".
Hi GoForSmoke -  As strange as it sounds, I'm not trying to repair a discman, mainly access this chip for creative/musical purposes, specifically manipulating the cd's material. Here are a couple of links to compositions using cd skips:

https://www.youtube.com/watch?v=YZLnFICwBUo
https://www.youtube.com/watch?v=0fvYoh7R3sU


As a rough connection outline for the project, I plan to unsolder/disconnect the 4 SPI pins on the SM5859AF from the Sony Discman board and connect those wires to the appropriate Arduino as specified by the SPI flow diagram I made/attached. This diagram assumes no level conversion is required.

Question(s):

The data sheet says recommended operating conditions for pin voltage is 2.7v to 5.5v. However, since the supply voltage for the Discman powering the SPI slave is 4.5v, it would be necessary for my Arduino SPI voltage to match the 4.5v, correct?

To make sure I understand the data sheet and concept correctly, I could theoretically use 3.3v for signals such as YMCLK because a value of 3.3v exceeds the 0.5*supply-voltage (2.25v) required for the level triggering of a successful pulse cycle period (as specified by the SPI Voltage diagram attached below)? However, YMDATA requires the entire voltage-supply range to send correct messages, thus requiring matching SPI voltage (4.5v) for this project?

This leads to my component architecture and desire to avoid level conversion if possible. For instance, the ATmega328/P has an operating voltage of 1.8 - 5.5V, meaning I could power the card at 4.5v and avoid the level conversion GoForSmoke details, correct?

Also, will any small differences in voltage arising from the separate power supplies for Master and Slave cause any communication failure between them?

I have some other questions regarding creating the proper YMLD signal but wanted to resolve these component, connection and conceptual questions first.

Thanks again everyone for being so helpful!


PaulRB

It's important that the SPI master and slave run at the same voltage, or the chips can be damaged.

An 8MHz AVR-based Arduino should run fine at 4.5V. A 16MHz AVR-based Arduino might run ok at 4.5V, it is not guaranteed, but no harm in trying. Connect 4.5V to the "5V" pin, bypassing it's on-board regulator.

GoForSmoke

I though that was an ARM SAM chip, 3.3V devices. I know boards with those that pin-tolerate 5V but that's the board.

Your chip runs at 4.5V and datasheet says 5.5V max then run it at 5V as .5V either way isn't just tolerable, some ripple is expected.

The V you need depends on the speed you run. AVR at 16MHz needs 4.5V to run stable. So if you give it 4.5V and there's move than 0.1V ripple, the brownout circuit might shut it down or unpredictable results (aka bad things) might happen... so 5V is desired.

You -could- run a 3.3V AVR board or chip at 8MHz which is still plenty fast and the spec on the chip you have covers that but maybe the circuitry it runs needs more than that.

For half a volt within spec anyway, I wouldn't sweat it much unless there's a safety or other extreme issue at stake.
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

soundbender123

Hi,

I powered the discman at 5v and it worked perfectly! Thank you for that idea GoForSmoke !

I've written SPI command code and am ready to connect the Discman…However, I think I destroyed the chip or disabled functionality…

I disconnected the Discman's SPI related pins from the board and attached leads to them that would eventually make their way to a breadboard/Arduino. I tried to make sure none of the Discman's SPI pins were touching each other as well. However, after making those changes. the disc would only play unless I was out of shock protection mode.

Should I, in fact, disconnect the SPI pins from the Discman board so that the lines go untouched on their way to the breadboard/Arduino, or just solder leads to the pins as is?

would soldering leads to pins that aren't connected to anything else usually cause this sort of disabling of functionality?

 I am going to get replacement chips/discmans to try again and see what I did wrong.

The pins are small and I easily could have destroyed the chip via soldering iron heat or mangling a pin but was wondering if any of you had insight as to what might cause this.

Thanks

PaulRB

I thought you were connecting one of these chips to an Arduino in isolation. I did not realise you were connecting to the chip in an existing circuit. That makes things much more complex. Impossible to say if it is a safe thing to do without understanding the rest of the circuit. The evidence would suggest it is not a safe thing to do!

Go Up