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 woes with CYWUSB6935 not reading MOSI line

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
JBM



Joined: 12 May 2004
Posts: 54
Location: edinburgh, Scotland

View user's profile Send private message

SPI woes with CYWUSB6935 not reading MOSI line
PostPosted: Tue Feb 10, 2009 12:13 pm     Reply with quote

I have a project using a CYWUSB6935 and a PIC18F2525, but it seems the radio chip isn't paying attention to data being sent on the MOSI line:

All attempts to read a register return the value 0x07, which is what would be expected if I requested a read of register 0 (as its power-on default is 0x07). Trying to write to a register fails, as the radio chip interprets is as a read from register zero and so sends back 0x07. Incremental reads also return 0x07.

The only thing I can think of that would cause such a fault is if the MOSI line were always sending zeros, but my code and logic analyzer tells me the data is being sent from my microcontroller correctly. The MOSI line is connected from the serial output of my controller to the MOSI pin of the radio and is pulled low with a 100k resistor.

Has anyone else had a similar experience or any ideas why this might be the case?
If anyone is interested, I can also post my board design if it would help.

Many thanks in advance
-JBM


P.S. The xtal out pin is giving me 13MHz as expected, supply voltage is 3.3v with less than 20mV ripple, and as I said my logic analyzer tells me that data is indeed being clocked out on the MOSI pin. The data clock rate is 2MHz, although lowering it makes no difference to the results. It's always clocking out 0x07.

And yes, I know it's a long shot someone else here having used this particular chip, but it's worth a try!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Feb 10, 2009 1:35 pm     Reply with quote

In the Cywusb6935 data sheet, the SPI interface is described on page 3
and the timing diagrams are on page 4.
http://download.cypress.com.edgesuite.net/design_resources/datasheets/contents/cywusb6935_8.pdf

See these threads for examples of an SPI driver.
http://www.ccsinfo.com/forum/viewtopic.php?t=37687
http://www.ccsinfo.com/forum/viewtopic.php?t=37562

Study those posts and write the routines for:
cywusb6935_write_reg()
cywusb6935_read_reg()

Also write the setup_spi() statement. At least one of those threads
tells how to determine the SPI mode. Here's another one with more info:
http://www.ccsinfo.com/forum/viewtopic.php?t=35566

Then make a small test program which has those routines in it, and
have it write and read from one or more registers in the cywusb6935.
Have it display the results on a terminal window.
JBM



Joined: 12 May 2004
Posts: 54
Location: edinburgh, Scotland

View user's profile Send private message

PostPosted: Wed Feb 11, 2009 5:40 am     Reply with quote

Thanks for your post PCM programmer, but it turns out my problem was an as-yet-unidentified hardware fault in that particular board I was developing my driver code on. I happened to switch to another identical board from the batch I made up and everything started working as it should.

Once I have a working driver and project I'll commit it to the code repository to save others some time!

-JBM
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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