CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

SPI Accelerometer (Freescale MMA7455L) and 16F886
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 17, 2011 5:03 pm     Reply with quote

Quote:

I am using USB 5V from my PC through a USB2TTL (serial) converter,
and then on the board i use a 3.3V regulator, all the capacitors are according to the datasheets and the voltage is ~3.31V


But you didn't answer the question.

1. What voltage is used for the PIC ?

2. What voltage is used for the MMA7455L ?
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Mon Jan 17, 2011 5:05 pm     Reply with quote

And the power supply circuit.
> 5V are from the USB
> VCC and VCC_PIC are the same (there are ICSP jumpers in other schematic page)
> C14 is near the PIC


_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Mon Jan 17, 2011 5:06 pm     Reply with quote

Both PIC and MMA7455 have the 3.3V from the regulator
_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Mon Jan 17, 2011 5:11 pm     Reply with quote

Somethimes there is problem due to the USB noise.

I just unplugged all stuff from the USBs and i only have the laptop on battery and nothing connected to it (using only wireless to comunicate to the outside :P)

And still the same for DIV/16... all 0x7F...
_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Mon Jan 17, 2011 5:16 pm     Reply with quote

I will read some Erratas from microchip, maybe i will find some bug in the PIC spi...
Or check if the CS lines are driven correctly.
_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 17, 2011 5:17 pm     Reply with quote

According to the 16F872 data sheet, it can't run at +3.3v.
http://ww1.microchip.com/downloads/en/DeviceDoc/30221c.pdf

Look at this diagram on page 118 (page 120 in the Acrobat reader):
Quote:
FIGURE 14-1: PIC16F872 VOLTAGE-FREQUENCY GRAPH

It shows 4.0v is the minimum voltage. Your board photo shows that
you are using the "F" version of the PIC.

To run at +3.3v, the PIC data sheet says you must use the "LF" version:
Quote:
FIGURE 14-2: PIC16LF872 VOLTAGE-FREQUENCY GRAPH
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Mon Jan 17, 2011 5:26 pm     Reply with quote

Aha... i didn't notice that... But that will make the PIC to not work, i mean, only the SPI module?? Because i have other stuff working in the PIC: rs232, leds, external interrupts, timer 0 and timer 1 interrupts and even a buzzer and all works... only the spi doesn't work? :S
_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Mon Jan 17, 2011 5:34 pm     Reply with quote

I'm dead.... :(
_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 17, 2011 5:38 pm     Reply with quote

Quote:
The pins of the accelerometer are:

14-SCK
13-SDI
12-SDO

Can you post the connection between the PIC and the MM7455L, and
only give the pin numbers (don't post the signal names).

For example, post this:

Pin 14 on the PIC connects to pin 14 on the MMA7455L.
Also do it the same way for the other 3 SPI signals.

I need to know the actual pin numbers on each connection so I can be
certain about your connections accuracy.
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Mon Jan 17, 2011 5:43 pm     Reply with quote

For SPI connections:
Pin 14 of the PIC connects to pin 14 of the MMA
Pin 15 of the PIC connects to pin 13 of the MMA
Pin 16 of the PIC connects to pin 12 of the MMA

For chip selects:
Accelerometer 1: Pin 3 of the PIC to the pin 7 of the MMA1
Accelerometer 2: Pin 4 of the PIC to the pin 7 of the MMA2
Accelerometer 3: Pin 5 of the PIC to the pin 7 of the MMA3
_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 17, 2011 5:55 pm     Reply with quote

The SDO and SDI signals are connected incorrectly.
You have SDI on the PIC connected to SDI on the MMA7455L.
Also, you have SDO on the PIC connected to SDO on the MM7455L.
This is wrong.

It's supposed to be:

SDO on the PIC goes to SDI on the MMA7455L.
and
SDI on the PIC goes to SDO on the MMA7455L.
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Mon Jan 17, 2011 6:01 pm     Reply with quote

Are u sure? Because according to the picture:



It looks ok... The pin 13 of the mma is the SDA/SDI/SDO and its connected to the SDA/SDI/SDO of the MCU, which on the PIC is the pin 15 (RC4/SDI/SDA)
_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 17, 2011 6:08 pm     Reply with quote

You posted this:
Quote:

For SPI connections:
Pin 14 of the PIC connects to pin 14 of the MMA
Pin 15 of the PIC connects to pin 13 of the MMA
Pin 16 of the PIC connects to pin 12 of the MMA


Look at Table 8 "Pin Descriptions" in the MMA data sheet.
I use those descriptions in the table below.
The table below shows your connections.
Code:

PIC pin   PIC Signal     MMA signal description   MMA pin
    14         SCK        SPI serial clock           14
    15         SDI        SPI data input             13
    16         SDO        SPI serial data output     12

You have SDI (input) on the PIC connected to "SPI data input" on the MMA
and also you have SDO on the PIC going to "serial data output" on the MMA.

This is wrong ! The way SPI is supposed to work, is the Master (PIC)
output goes to the input pin on the Slave (MMA), etc. You have both
inputs connected together and also both outputs connected together.
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Mon Jan 17, 2011 6:10 pm     Reply with quote

Now i am sure of nothing :S :S

I can still invert the pins... not easy but the quantity of 0ohm resistors will give a help :/

Are you sure that they are incorrect? Actually i was checking a design that i made using a digital potentiometer through SPI and the pins are like you told... So i made mistake while looking to the image? Because its the same in the datasheet of the MMA?
_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Mon Jan 17, 2011 6:15 pm     Reply with quote

Ok, i will change and see what will happen.

Thank you so much!
_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group