MC9S08GB32 Examples

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MC9S08GB32 Examples

5,155件の閲覧回数
billp
Contributor I
Is there an example for MC9S08GB32 using the SPI transmitting and receiving characters?  I have tried the one for the MC9S08GB60 and can't get it to work.  Just wondering if there is something for the 32 that has been written and tested.
 
Bill
ラベル(1)
0 件の賞賛
7 返答(返信)

483件の閲覧回数
billp
Contributor I

I was asked these questions..

1. Is the Slave Enabled?
2. Both SPI ports are configured for the same Clock Type (rising edge, falling edge, etc?
3. MOSI connected to MISO?

1) I have a master and slave now.

2) The SPI Ports are definitely all set up the same, except I noticed in the example file the slave has the SPI1BR = 0x35; commented out.

3) Not sure how to check this, can you tell how to find out it MOSI is connected to MISO?

0 件の賞賛

483件の閲覧回数
rhinoceroshead
Contributor I
1) I think Alex was speaking of the 'SS' (slave select) signal.  Many SPI devices will not respond without being selected first, thus allowing more than one slave device to connect to the master.  So before the master transmits, it should drive the SS pin on the slave device low.  I believe there are some configuration options though - it's been a while since I looked at the SPI module datasheet.
 
2)  The baud rate is irrelevant on the slave device since it doesn't drive the clock so it can be commented out
 
3)  Make sure the MOSI pin is NOT connected to MISO.  The MOSI pin of the master should be connected to the MOSI pin of the slave and the MISO pin of the master should be connected to the MISO pin of the slave.  The pin names should show up on the datasheet.
MISO = Master In, Slave Out
MOSI = Master Out, Slave In
 
If you connect MOSI to MISO then you can use the device in bi-directional mode and it only uses one wire.
 
It might be more helpful if you post the code that you are using and describe how the two devices are connected.
0 件の賞賛

483件の閲覧回数
billp
Contributor I
I want to have two chips in Master mode sending and receiving to each other.  So I did not use the Slave mode.  After reading the documentation I thought I could send and receive in Master Mode using the MOSI and MISO?  I really didn't want to use the interrupt vector either for sending or receiving.
0 件の賞賛

483件の閲覧回数
rhinoceroshead
Contributor I
The master device is the one that drives the data clock.  You can't have both devices driving the data clock or you will have signal contention on the clock pins.  Configure one of the devices to be the master and the other to be the slave.
 
You can get two devices to communicate using only one data pin in the bi-directional mode - this may be what you're thinking of - but you still have to pick one device to be master and another to be slave.
0 件の賞賛

483件の閲覧回数
rhinoceroshead
Contributor I

There shouldn't be a difference in the SCI operation between those two chips.  The only difference is the amount of FLASH.  Can you post the code you are using?

Did you check things like:

1)  Rx and Tx pins are not backwards

2)  Clock is trimmed (if using the internal clock)

3)  Clock dividers set properly for that BAUD rate

4)  Same serial settings for bits, parity, on both the DTE and DCE

Do you see garbage on the terminal or nothing at all?

0 件の賞賛

483件の閲覧回数
alex_spotw
Contributor III
Hi:

The initial post ask about SPI commnunication, not SCI. Therefore, the questions to ask should be more like:

1. Is the Slave Enabled?
2. Both SPI ports are configured for the same Clock Type (rising edge, falling edge, etc?
3. MOSI connected to MISO?


Regards,

Alex R.
0 件の賞賛

483件の閲覧回数
rhinoceroshead
Contributor I
My mistake.  :smileyhappy:
0 件の賞賛