Skip to main content

Show Posts

This section allows you to view all Show Posts made by this member. Note that you can only see Show Posts made in areas you currently have access to.

Messages - JoseJX

1
Bus Pirate Support / Re: Hardware I2C master and slave
Sorry I've been so busy with work for the past few weeks, I haven't had a chance to work on this at all. I am happy to report that the new firmware does work with my PIC18F slave device, so, nice work!

The PIC18F slave device code I've written would work for a slave implementation on the bus pirate, I'll get to work on porting it over as soon as I have more free time. Sorry again!
2
Bus Pirate Support / Re: I2C, no ACK at random times
Sorry, I've been kind of busy with work and haven't had time to figure out what's not working with my I2C code (with open drains turned on, it seems to always hold the line low, even if the tristate shouldn't be allowing that). I'll hopefully get a chance next week, but I can't promise anything right now.

Sorry again!
3
Bus Pirate Support / Re: I2C, no ACK at random times
I think I've found another problem, while reading the specs and some sites about I2C. I've noticed that your software implementation doesn't send a NACK after reading the last byte.

On this site, it suggests that's a requirement:
http://www.robot-electronics.co.uk/htm/ ... 2c_bus.htm

I've decided to rewrite the software I2C routines using the outline on this website. The size of the code drops by about 250 bytes with my new routines and they'll be licensed the same way as the rest of the BP code, which is nice. I've been busy over the weekend and didn't have time to test the code, but will have a chance in the evening tonight. Once I'm sure it's okay, I'll post the diff and hopefully we'll have something working properly.
4
Bus Pirate Support / Re: Bus Pirate or logic analyzer
For a simple logic analyzer, I use my PICKit 2. It's only good for signals up to 500Hz, but for a lot of hobby applications, this is okay.  It's only 3 channel, but in a pinch, with hardware many already have, it's still useful!

On windows, Microchip's software works fine. On Linux/OSX, you can use my version of the tools, located at http://pk2-la.sf.net

This is the tool I'm using to figure out what's going on with the I2C issues. :)
5
Bus Pirate Support / Re: Hardware I2C master and slave
A patch enabling the hardware I2C module is up at http://dev.gentoo.org/~josejx/bus_pirat ... wI2C.patch

I made it print the warning once per session, more seemed like overkill (I tried it a bit and it was annoying). Instead, I've made the user press 1 to continue despite the warning or 2 to cancel and go back to Hi-Z mode, hope that's okay.

Note, you'll have to add I2Cb.c to your project before committing, it's not currently in the project and doing so really changes the project file, so I figured I'd let you do it.
7
Bus Pirate Support / Re: I2C, no ACK at random times
Sorry if I wasn't clear, here's what I'm talking about:

Quote
I2C> { 0x52 0x00 0x65 } Write 2 bytes to the PIC at address 0x52, starting at internal address 0x00
I2C START CONDITION
WRITE: 0x52 GOT ACK: YES
WRITE: 0x00 GOT ACK: YES
WRITE: 0x65 GOT ACK: YES
WRITE: 0x66 GOT ACK: YES
I2C STOP CONDITION
I2C> { 0x52 0x00 } { 0x53 r r } Write internal address to 0x00, then read two bytes
I2C START CONDITION
WRITE: 0x52 GOT ACK: YES
WRITE: 0x00 GOT ACK: YES
I2C STOP CONDITION
I2C START CONDITION
WRITE: 0x53 GOT ACK: YES
READ: 0x65
READ: 0x66
I2C STOP CONDITION
I2C>

This was the test I was running before. It works up to this point. If I follow this up with other commands, the device doesn't respond properly and continues each command as a read as observed by a dump of the internal I2C registers to an LCD on the PIC18F. It stays stuck (no stop rx'd) until I send a command that ends in 0's:

Quote
I2C> { 0x52 0x00 0x00 }
I2C START CONDITION
WRITE: 0x52 GOT ACK: YES
WRITE: 0x00 GOT ACK: YES
WRITE: 0x00 GOT ACK: YES
I2C STOP CONDITION
I2C>

After this, I can write to the internal registers and start another read cycle. I'm not 100% sure where the bug is (in my PIC18F code or in the bus pirate) but it should be pretty obvious once I get the Logic Analyzer attached.

On a side note, I2C on PIC is harder than it initially appears. :)
8
Bus Pirate Support / Re: I2C, no ACK at random times
Can you do as many writes as you want? Is it only reading that's screwing up?

On my PIC18F that I'm using as a test slave device, I am seeing reads miss the final stop bit (bulk or not). Sending a write with two 0's seems to fix it and let it work again. I missed this before because I was just testing a write followed by a read. :p

I will hook it up to a logic analyzer later today to see if it's properly sending the stop condition after a read.
11
Bus Pirate Support / Re: I2C, no ACK at random times
Another thought, does the device support "restarts" where the start command is given again without a stop for the last command? Does it work properly if you specify a stop command before the read?
12
Bus Pirate Support / Re: I2C, no ACK at random times
I am also seeing some incompatibility with I2C and a random assortment of devices. One issue that I've found is that the software I2C routines clock at only about 3.4KHz, which is too slow for some devices. The hardware I2C routines mentioned in another post will hopefully fix this issue.

What speed is the device that you're trying to interface with?
13
Bus Pirate Support / Re: Hardware I2C master and slave
Okay, so the HW I2C seems to work okay with another PIC18F running as a slave at 100KHz. This is good, although I haven't checked to make sure the rate is actually 100KHz.

However, I haven't gotten it to work with a Wii Nunchuck which runs at 400KHz, perhaps it's a pullup issue, more testing and poking at it is required.

A few questions:
Should the hardware I2C module allow pullups on other hardware than the v0a? I suspect so.
Was there a reason for the characters at the start of many of the messages in the HWI2C module?

I've updated the hwi2c patch to reflect the above changes. Once I'm sure that the master module is working properly, I'll write the HW I2C slave module.
14
Bus Pirate Support / Re: Hardware I2C master and slave
Sure, I didn't specify any license because I usually just assume that the license is the same as whatever I'm patching! Sorry about that! Feel free to take any of my patches for this project under the correct license for the component I've written the patch for.

I actually got the built in functions from the bootloader code. :)
15
Bus Pirate Support / Re: Hardware I2C master and slave
Cool, I've got it working. I meant C30, I've only worked with 18F PICs in the past, so sorry for the confusion. My issue was not exporting the HEX file after compiling.

Now that it's all sorted, I've got a patch to re-enable the HW I2C component: http://dev.gentoo.org/~josejx/bus_pirate/i2c.patch I haven't yet tested it since I'm still at work, but I'll get to it tonight and follow up.

Also, I see you've added code to print the revision. Instead of using the inline assembly, why not use the builtins: __builtin_tblrdl() and __builtin_tblrdh()? I think they're easier to read. Perhaps it would also be a good idea to store these values somewhere so we can check them without having to read from the flash multiple times?

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.01612428576session_write_close ( )...(null):0
20.01642560144ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.01642560920Database_MySQL->query( ).../DatabaseHandler.php:119
40.06252699624Database_MySQL->error( ).../Db-mysql.class.php:273