Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Help needed for SPI

Status
Not open for further replies.

Rajaneesh

Member
Dear techies,

I need help in getting the data from MCP3550 - 22bit Delta sigma ADC chip using SPI. Iam unable to get the data out through SDO.

I have tried as per the data sheet, but it doesn't work.
 
You need to post your code and schematic.

Thanks 3v0 / Diver.....

Here is the code for the reg conf.....

Please go through and guide me...
 

Attachments

  • spi test.c
    746 bytes · Views: 190
You can't just send data out with SPI, you have to receive it as well, after you send a byte you have to wait until a byte is received (BF=1) and then read SSPBUFF. Microchip have a good document explaining it.

Mike.
 
First let me say that I have just started working with SPI and only with the MCP41XXX.

You can't just send data out with SPI, you have to receive it as well, after you send a byte you have to wait until a byte is received (BF=1) and then read SSPBUFF. Microchip have a good document explaining it.
Mike.

I understand why you are saying the above. But some of the Microchip SPI enabled chips do not conform. For example the MCP41XXX digital pot does not have an SO pin. It is a send and pray transfer. The dual version MCP42XXX has an SO pin but it is used to dasiy chain these devices and does not connect to the master SI pin.

The MCP3550 has no SI pin. It is a read only device execpt that the CS line is used to start a conversion.

datasheet said:
The status of the internal conversion
is the SDO/RDY pin and is available with CS low.
A High state on SDO/RDY means the device is busy
converting, while a Low state means the conversion is
finished and data is ready for transfer using SCK.
SDO/RDY remains in a high-impedance state when
CS is held high. CS must be low when clocking out the
data using SCK and SDO/RDY.
 
First let me say that I have just started working with SPI and only with the MCP41XXX.



I understand why you are saying the above. But some of the Microchip SPI enabled chips do not conform. For example the MCP41XXX digital pot does not have an SO pin. It is a send and pray transfer. The dual version MCP42XXX has an SO pin but it is used to dasiy chain these devices and does not connect to the master SI pin.

The MCP3550 has no SI pin. It is a read only device execpt that the CS line is used to start a conversion.

Hi 3V0,

I have tried to get the data by making CS low, but i couldnt get any data through SDO... Can u help me in this regard....?
 
First you did not provide a schematic as I asked. I know it is simple but simple mistakes will prevent it from working. We could write pages of text about the software and it would not help if you have not wired it correctly.

A quick look at you code shows that you are using the hardware SPI. The hardware expects the slave to play nice as in the document Mike pointed out. It may be easier (at least to start with) to bit-bang the code (not use the hardware SPI). Read the serial communication section of the data sheet to see what you need to do. The nice thing about this is that you can easily debug the data transfer one bit at a time using a logic probe of even a volt meter.

I have never used the hardware SPI. If you want to go that route you need help from someone who has. You need to study and understand the processor datasheet, the compiler doc for the SPI routines, and the data sheet for the slave MCP3550.

Hi 3V0,

I have tried to get the data by making CS low, but i couldnt get any data through SDO... Can u help me in this regard....?

Again post the code you used. The schematic would be nice too, does not have to be fancy just readable. At least tell us what MCP3550 pins are connected to what processor pins.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top