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 CCS Technical Support

I2C to USB
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

I2C to USB
PostPosted: Thu Jul 16, 2020 11:14 am     Reply with quote

Hi all,

Do you know of any product that I can use in order to use my computer as a I2C master via USB? I would use it to test out products without having to go through a hardware setup with another PIC saving myself another layer of debug, possibly.

I'm thinking of a combination of Realterm with a FT232RL, but for I2C instead.
Ttelmah



Joined: 11 Mar 2010
Posts: 19497

View user's profile Send private message

PostPosted: Thu Jul 16, 2020 12:43 pm     Reply with quote

Look at the one RobotShop does.
Has a nice simple command interface so makes setting up the PC end
relatively easy.
<https://www.robotshop.com/uk/devantech-usb-to-i2c-module.html?utm_source=google&utm_medium=surfaces&utm_campaign=surfaces_across_google_uken&gclid=EAIaIQobChMI3L_jhrbS6gIVyIBQBh2ZHQHOEAQYBSABEgITTPD_BwE>
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

PostPosted: Thu Jul 16, 2020 12:51 pm     Reply with quote

Thanks, that's a good reference. I'll look for a version that maybe lets me select between 5V or 3.3V
Ttelmah



Joined: 11 Mar 2010
Posts: 19497

View user's profile Send private message

PostPosted: Fri Jul 17, 2020 12:47 am     Reply with quote

Problem is that to do 3.3v as well, would need a regulator, and really the
ability to change the pullups used as well. Starts to get complex. Saida
do a USB module with the two voltage option, but it doesn't allow these
other settings. Instead it relies on you providing the voltage and the
pullups. Chinese and possibly dubious quality.
Diolan do a number of modules with all these options, but they are
harder to drive than the Devantech module, and more expensive....
<https://diolan.com/usb-i2c-adapters-comparison>
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Jul 17, 2020 4:28 am     Reply with quote

Ah, yet another 5v vs 3v problem.....
Since this is for testing on your PC, I suggest TWO interface modules.
Put a green dot on the 5 volt device, an orange dot on the 3 volt device.
That makes it obvious what voltage they are and should eliminate 'bad puffs of smoke '..

Jay
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

PostPosted: Fri Jul 17, 2020 8:25 am     Reply with quote

Alright thanks for these suggestions... I'll have to take some time to look through each of the specs.
MikeW



Joined: 15 Sep 2003
Posts: 184
Location: Warrington UK

View user's profile Send private message

PostPosted: Sat Jul 25, 2020 1:03 am     Reply with quote

this works- FT232H

Application Note AN_255 USB to I2C Example using the FT232H and FT201X devices

https://www.ftdichip.com/Support/Documents/AppNotes/AN_255_USB%20to%20I2C%20Example%20using%20the%20FT232H%20and%20FT201X%20devices.pdf
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Jul 25, 2020 6:53 am     Reply with quote

www.i2cchips.com have a bl233b chip for $4. Looks like a preprogrammed PIC to do the serial<>I2C work.
looks like a fairly easy/simple/effective way to get what you want.
I'd still have 2 though, one 'green' one for 5 volt, one 'orange' for 3 volt.

Jay
drh



Joined: 12 Jul 2004
Posts: 192
Location: Hemet, California USA

View user's profile Send private message

PostPosted: Sat Jul 25, 2020 7:50 am     Reply with quote

https://www.totalphase.com/products/aardvark-i2cspi/
_________________
David
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Jul 25, 2020 9:46 am     Reply with quote

yeesh that's kinda pricey...$300 when you can use a $2 USBTTL module and a $1 PIC....
yup, I'm old and frugal....still like Assembler too !
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

PostPosted: Sat Jul 25, 2020 9:55 am     Reply with quote

Yes, that's a bit steep. But my idea with this was to use it for testing i2c devices with a known master hardware setup that I can be certain is working correctly.

Perhaps I should just make my own with a computer GUI that allows me to program send a list of i2c via UART. I could possibly even provide my own jumper to select between 5v or 3.3v levels. If I'm reading this right, if I use something like the PIC16F19156/another one in that family, I can still run at full speed when powering at 3.3v. Is there a reasoning flaw there?

This actually sounds like a practical project that could be quite fun to do... Since I'm in no rush, I might put this aside as an idea.
Ttelmah



Joined: 11 Mar 2010
Posts: 19497

View user's profile Send private message

PostPosted: Sat Jul 25, 2020 10:41 am     Reply with quote

No reasoning flaw, but the hardware may be slightly more complex than
you think, and then you have the decision of the command language to
use.
Hardware more complex, since you will have to deliver the powrr to the
usb buffers correctly for both voltages. The setup is normally different
for 5v and 3.3v operation.
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

PostPosted: Sat Jul 25, 2020 10:50 am     Reply with quote

Thanks for the warning :P

Yes, I would need to write my own set of UART messages to send around, although I have already written a pretty robust library for message buffers and parsing so I just need to figure out _what_ to send from my GUI.

As for the USB side, I was thinking of using something like a 5V version of the Sparkfun FTDI Basic. That could provide the input voltage to a 3.3V LDO on my board, right? (so actually not a truly self contained board)

Then a jumper can be used to set the the 5V or 3.3V for I2C pullups and the slave power.

If I use a PIC24, there are 3.3V MCUs with 5V tolerant pins, so I could remap and use those for the UART and SPI.
Ttelmah



Joined: 11 Mar 2010
Posts: 19497

View user's profile Send private message

PostPosted: Sat Jul 25, 2020 11:50 am     Reply with quote

A 5v tolerant pin, doesn't give the switching needed for 5v I2C.
The PIC's operating voltage has to physically change to 5v and to 3v.
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

PostPosted: Sat Jul 25, 2020 11:52 am     Reply with quote

Ttelmah wrote:
A 5v tolerant pin, doesn't give the switching needed for 5v I2C.
The PIC's operating voltage has to physically change to 5v and to 3v.


Oh, I thought that if I simply pulled a voltage up to 5V, then it would pass that threshold required for a high voltage regardless of the PIC power, and low voltage would simply be zero.

I guess I do need to think about it some more...
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 1, 2  Next
Page 1 of 2

 
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