1
\$\begingroup\$

I am using an Renesas RL78 and SPI to communicated with an SD card. I have the driver working using the single command Baudrate of 400kBaud when sending both commands and data.

Of course, this is very slow for data transfer, so I have implemented a method to switch the Baudrate to 4MBaud when transmitting data.

I can see a data response from the SD card but it is always incorrect - I'm expecting to see 0xFE and I'm getting 0xFC back. To test what was causing this, I tried changing my set_spi_baudrate() method to disable and re-enable the SPI channel (allowing the change) but not to actually change the baudrate from the slower speed. It seems the act of enabling and disabling the SPI channel is causing the behaviour.

Does anyone have any idea on how to properly switch Baudrates dynamically in this device?

\$\endgroup\$
2
  • \$\begingroup\$ It is likely that you need to follow a short procedure to switch baudrates on the fly, if so it should be in the datasheet of the device. Do you have the datasheet available? Is there a chapter on UART or USART? \$\endgroup\$
    – jippie
    Apr 29, 2013 at 10:09
  • \$\begingroup\$ My problem was actually that I was trying to change the baudrate back to the lower level during each command response. I misinterpreted the SD SPI spec, assuming that all commands needed to be communicated at the lower frequency. \$\endgroup\$
    – Ed King
    Apr 29, 2013 at 11:11

1 Answer 1

3
\$\begingroup\$

My problem was actually that I was trying to change the baudrate back to the lower level during each command response. I misinterpreted the SD SPI spec, assuming that all commands needed to be communicated at the lower frequency.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.