328 Views 17 Replies Last post: Aug 10, 2010 4:30 AM by stowoda RSS
stowoda Newbie 89 posts since
Mar 6, 2009
Currently Being Moderated

Mar 10, 2010 3:53 PM

M16C24 & Hardware SPI

Hi there.

 

Are there any application notes on how to use SPI with a device like M30245?

I am missing the CS line? Do I have to manage that in software or is it possible to do the hardware the job?

 

 

regards

luke

FrankL Apprentice 1,123 posts since
Mar 16, 2009
Currently Being Moderated
Mar 11, 2010 2:44 AM in response to: stowoda
Re: M16C24 & Hardware SPI

CS must be managed by software.

Regarding application notes, I think you can refer to application notes for M16C/62A or M16C/62P. Their serial interfaces are quite similar to M16C/24.

FrankL Apprentice 1,123 posts since
Mar 16, 2009
Currently Being Moderated
May 27, 2010 12:56 AM in response to: stowoda
Re: M16C24 & Hardware SPI

Did you try to use a 16-bit write to u3tb?

FrankL Apprentice 1,123 posts since
Mar 16, 2009
Currently Being Moderated
May 27, 2010 5:42 AM in response to: stowoda
Re: M16C24 & Hardware SPI

Which processor do you use?

I don't know any M16C processors that have u3smrx registers.

And please have a look at the application examples on the Renesas homepage. For most processors there is an example for clock synchronuous operation.

FrankL Apprentice 1,123 posts since
Mar 16, 2009
Currently Being Moderated
May 27, 2010 7:29 AM in response to: stowoda
Re: M16C24 & Hardware SPI

Sorry, I got carried away as the u3smr registers are listed only in one figure.

Have you tried to set the registers manually and see what is transmitted?

I did so, and I dfon't have a problem with the first bit. THe TxD line keeps the state of the last bit. So I send 0x0F. Then I see that the first 4 bit are 0, the second 4 bit are one.

FrankL Apprentice 1,123 posts since
Mar 16, 2009
Currently Being Moderated
May 27, 2010 8:54 AM in response to: stowoda
Re: M16C24 & Hardware SPI

If signals on rising and falling edge are the same you have a problem with the UART initialisation.I also transmit 0x36 once on rising and once on falling edge. You can see the shift immediately.

http://www.renesasrulz.com/servlet/JiveServlet/downloadBody/1531-102-1-1444/DifferentEdgeSignal.zip

And what do you mean by RxD lines are reversed. It is correct that if TxD shifts data out on falling edge, then RxD has to read on rising edge. BUt for the register settings, this is exactly the same setting. If TxD is set to change output data on falling edge, this implies that RxD reads data on rising edge and vice versa.

FrankL Apprentice 1,123 posts since
Mar 16, 2009
Currently Being Moderated
May 27, 2010 9:45 AM in response to: stowoda
Re: M16C24 & Hardware SPI

The transmit buffer (address 0x32A) is a bad example as this register is write only. I wrote the values you mentioned earlier:

- 0x01 to address 0x328 (u3mr)

- 0x92 to address 0x32C (u3c0)

- 0x01 to address 0x32D (u3c1)

- 0xFF to address 0x329 (u3brg)

and then for transmit I only write 0x36 to address 0x32A (as 8 bit value which works fine).

To change transmit polarity I write 0xD2 to 0x32C.

Just note that some bits are read only bits like transmit buffer empty flag or transmit register empty flag not all values will change as you write them.

FrankL Apprentice 1,123 posts since
Mar 16, 2009
Currently Being Moderated
May 27, 2010 8:27 AM in response to: stowoda
Re: M16C24 & Hardware SPI

I use a debugger (KD30 in this case), open a memory window and write to the registers manually.

More Like This

  • Retrieving data ...

Bookmarked By (0)