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.

Problem with Serial Peripheral Interface

Status
Not open for further replies.

tkvenki

New Member
Hi All,

I'm using a VS2000 controller. I want to test my SPI port by using the DS1305 RTC.

I'm able to open the SPI device in my controller.
Also I'm able to set the configuration.
But When I'm trying to write to the RTC i'm getting a failure.

Please find the chunk of code below:
/*******************************************************/
no_frames_to_tx =2;
no_frames_to_rx=0;
tx_buffer[0] = 0x8F;
tx_buffer[1] = 0x00;

bytes_trans = DCT_SPITransfer(hSPI[INSTANCE(0)],no_frames_to_tx/*=2*/,tx_buffer,no_frames_to_rx/*0*/,rx_buffer);
printf("Check out whether the CR is written --> %d", bytes_trans);
/*******************************************************/

In the above code what i expect is the bytes_trans variable should be 2, but I'm getting it as 0.

I'm not able to figure out the cause for it.
Please let me know the areas in which i can concentrate.
Please find the circuit diag. attached to this mail.
In the circuit diagram please note that i have not connected the CS pin to uC.

Thanking you,
Venki
 

Attachments

  • uC_to_SPI_Interface.JPG
    uC_to_SPI_Interface.JPG
    24.6 KB · Views: 140
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top