Changing cape from CAN to RS232

I needed a couple of RS232 ports for my BBB. However there seems to be a shortage of RS232 capes in the world, Farnell is quoting over a month delivery time.
But they had CAN-BUS capes in stock, and that’s the same PCB. So I got a couple of CAN-BUS cards and made the following modification:

Moved the 0ohm jumpers from R1,R2,R38,R39,R48 to R26,R27,R42,R43,R49
Mounted C12-C16 plus the U4 transceiver chip.

So now I should effectively have a RS232 Cape on UART1.

Except there seems to be some kind of board id in the little I2C EEPROM that sits on the cape.

The documentation at http://elinux.org/Capemgr has a link to a System Reference Manual, but the link is dead.

So… questions:

Is there any utility to write to the cape EEPROM?
What is the correct boardname to store in the EEPROM for the RS232 cape?
Anyway to make the OS use the UART as a serial port without modifying the cape EEPROM?

/jesper

If you need RS232 , what my first choise is USB convert . since you need some chip convert from UART to RS232 , why not use USB ?

Maybe you can consider it

Several reasons, but please, this is not the topic of this post. I would prefer getting responses to my questions…

utility to write to the cape EEPROM?

hexedit works for me just fine

Please try to understand the question before responding :slight_smile:
Hexedit is a fine tool for editing binary files on your hard disk, but it has no knowledge what so ever of I2C bus communication or EEPROMs…

OK, after half a day of fiddling I am a little wiser.

It seems that the kernel already has the 0x54 - 0x57 addresses on I2C-1 in use, even if there is no cape there.
So I can’t get at the EEPROM.
I guess the cape manager driver keeps holding on to these, and somehow I need to disable it to be able to access the EEPROM.

And obviously I also need a paper clip across TP1 and TP2 :slight_smile:

But I am sure somewhere there is a utility for Cape developers to write their EEPROMs… Any chance anyone can help me along?

Oh, and as a side remark, the kernel doesn’t want to load the CAN bus cape either, since it is version A2 and the latest official Angstrom distro only supports A1:


bone_capemgr.8: slot #0: ‘BeagleBone CANBUS CAPE,00A2,Beagleboardtoys,BB-BONE-SERL-01’

bone_capemgr.8: slot #0: Requesting part number/version based 'BB-BONE-SERL-01-00A2.dtbo
bone_capemgr.8: slot #0: Requesting firmware ‘BB-BONE-SERL-01-00A2.dtbo’ for board-name ‘BeagleBone CANBUS CAPE’, version ‘00A2’

bone_capemgr.8: failed to load firmware ‘BB-BONE-SERL-01-00A2.dtbo’
bone_capemgr.8: loader: failed to load slot-0 BB-BONE-SERL-01:00A2 (prio 0)

root@beaglebone:~# ls /lib/firmware/BB-BONE-SER*.dtbo
/lib/firmware/BB-BONE-SERL-01-00A1.dtbo /lib/firmware/BB-BONE-SERL-03-00A1.dtbo
root@beaglebone:~#

Maxim

You must have some magic Hexedit that writes I2C . Very nice (-: how does that work?

i2c-tools - built in to tools. BUT as you have already discovered, Capemgr is tied into the i2c ports and as soon as it detects an EEPROM programmed for a cape, it will load it. Sooo, disable the cape first, see http://circuitco.com/support/index.php?title=Weather_Cape_Work-Around for how to disable capes in the uEnv.txt file. Once you place the label for the CAN cape in the disabled list, Capemgr will refuse to load it no matter what. That should free up the EEPROM so you can program it.

Of course, there is no reason to program it, just create a DTS for it and load it manually. See http://www.berriman.co.uk/beaglebone-black-with-rs232-cape/ for a writeup on creating a DTS file and loading it for an RS232 cape. Of course, you will need to modify this as needed to match your pin layout.

You use one of the Linux I2C EEPROM drivers to access the EEPROM like a file. I don’t have any capes, but it is quite possible that Linux already mounted that for you.

Check for the directory /sys/bus/i2c/devices/X/eeprom

Where X will change depending on the address of the device and which i2c port it is on.

If it’s there, you can edit it directly as the super user.

Thank you Gary, brilliant!
That made it simple to alter the partnumber and get the correct dts loaded:

(I didn’t bother to change the board name :slight_smile: )


bone_capemgr.8: slot #0: ‘BeagleBone CANBUS CAPE,00A0,Beagleboardtoys,BB-UART1’

bone_capemgr.8: loader: after slot-0 BB-UART1:00A0 (prio 0)
bone_capemgr.8: slot #0: Requesting part number/version based 'BB-UART1-00A0.dtbo
bone_capemgr.8: slot #0: Requesting firmware ‘BB-UART1-00A0.dtbo’ for board-name ‘BeagleBone CANBUS CAPE’, version ‘00A0’
bone_capemgr.8: slot #0: dtbo ‘BB-UART1-00A0.dtbo’ loaded; converting to live tree

Ah, so you were able to edit the eeprom through a sys file then? A brief writeup on what you did would be nice so others have more concrete steps beyond my vague “it’s somewhere in the directory tree”.

I’m perfectly happy poking through the file trees and source trees but there are a lot of people with different skillsets coming to these forums who might not… [I have NO idea how you managed to turn a CAN cape into an RS232 cape…the idea of trying to modify those little boards makes me shudder… :-)]

Sure, here it goes:

First of all, the CANBUS, ProfiBUS, RS232 and RS485 capes from Beagleboardtoys all share the same PCB. It’s just different components mounted, and different jumpers configured.
So what I did to the hardware was to unmount the 5 jumpers connecting the CANBUS chips to the UART and connector, and instead mount them to connect the RS232 driver chip, which I also mounted.
Yes, hand soldering 0402 chip components is not for the faint of heart, or for those with un-sharp soldering irons. I have plenty of experience and a MIL-SPEC soldering certificate…

So now the software part: The only thing that is important for the kernel cape manager is the board part no and revision no in the EEPROM. The EEPROM format is specified in the BB System Reference Manual, except for one thing that is missing: It says the part number is 16 bytes. If you have a part no shorter than 16 bytes you need to pad it with “.” characters. I wanted to use a .dts file that was already available in the Angstrom distribution, so I called my cape a “BB-UART1…” of revision A0.

I had some trouble trying to edit the eeprom directly, probably because the editor tried some smart way of saving that a Flash memory driver didn’t like… so I made a copy, edited, and then copied the content back:

cp /sys/bus/i2c/devices/1-0054/eeprom ẽeprom
vi -b eeprom
…make edits in Replace mode…
cp eeprom /sys/bus/i2c/devices/1-0054/eeprom

The copy into the eeprom takes a LONG time. I2c is not a fast thing…
Also notice I used vi in binary mode. You can use any binary file editor, even hexedit :slight_smile:

Now with a correct board part no and revision the kernel will automatically load the driver at boot.

Hello,

I had the same need and try to change my RS485 cape into a 232 one on my BB White.
I have the folowing issue :
the command cp eeprom.new /sys/bus/i2c/devices/3-0054/eeprom failed due to connexion timeout.
When trying some commands with i2ctools, the ressource device seems to be busy.

Any idea about what I missed ?
Thanks a lot for any help.

Well according to the PDF schematics for the RS485 cape, the Write Protect pin is tied high on it’s EEPROM and from the datasheet that turns on write protect for that eeprom.

You did do something to cut the power to the WP pin right?

Shame on me… I missed that.
I will cut the power to that pin and try again tomorrow.
Thanks for your help.
Stéphane

Sorry, I forgot to mention that :frowning:

There are two ENORMOUS test points, TP1 and TP2. Put a piece of wire between them and the EEPROM is unlocked for writing.

/jesper

I’ve noticed that. Easy to do and works fine.
Thanks again for your help.
Stéphane