# Renesas RL78 SPI Baudrate Change

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?

• 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? Apr 29 '13 at 10:09
• 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. Apr 29 '13 at 11:11