MC9S08GB32 Examples

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MC9S08GB32 Examples

5,138 Views
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
Labels (1)
0 Kudos
7 Replies

466 Views
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 Kudos

466 Views
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 Kudos

466 Views
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 Kudos

466 Views
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 Kudos

466 Views
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 Kudos

466 Views
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 Kudos

466 Views
rhinoceroshead
Contributor I
My mistake.  :smileyhappy:
0 Kudos