April 29, 2024, 11:05:08 PM

Debugging the MOD-IO2 with Pickit3

Started by Bernd, January 24, 2013, 01:02:02 AM

Previous topic - Next topic

Bernd

I cannot get the MOD-IO2 to talk to the A13 board, so I tried to debug the firmware of the MOD-IO2 using a Pickit3.

When I start the debugger I always get the error message that the configuration buts are not set correctly, so debugging is not possible.

Is is actually possible to do that? I have read something that there might be some header board necessary to to debugging with the PIC16f1503.

LubOlimex

Hey Bernd,

Well a colleague wrote the firmware without debugging :) But you are correct about the header: http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en553475. Check the top under "Debug support".

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

Bernd

#2
Hi Lub,

WOW, he is a hero! Writing embedded software like in the good old times. :)

I'm trying to use the MOD-IO2 with the A13 WIFI and a debian kernel and I always get communication errors. It shows up with i2cdetect once and already the second time it is gone.

The old firmware was somewhat better and I was able to switch one the relays once (at about the 10th try) but got mostly communication errors as well.

I verified with the guy who built the kernel that the correct clock speed is used, So I assume that the problem ist at the MOD-IO2 side and debugging might have helped a lot. :)

Bernd


Bernd

This afternoon I took a closer look at the firmware of the MOD-IO2 and found a few things:

- The firmware uses it's own I2C implementation instead of the hardware I2C module of the PIC. I assume that it doesn't cover all the I2C states the Linux subsystem uses, so it seems to get in an undefined state pretty soon and doesn't respond anymore.

- The addressing scheme of the MOD-IO2 is a bit strange. It always uses 0x48 as the real I2C address and then two more bytes for board type and board. From all I have read each I2C device on the bus has to have it's own real I2C address.

I have played around with the PIC I2C module and was able to establish basic communication between the MOD-IO board and The A13 board. Debugging using relays is something I have never done before. :D

LubOlimex

Hey Bernd,

Glad you are making progress.

You are correct for the things you've noticed. There were reasons the SPI was implemented on software level, though.

Debugging with relays is cool, you can also write small memory dumps in a file (for example) in specific places you are curious about. It is still some help with the debugging.

Just ensure you are working on the latest firmware of MOD-IO2: https://www.olimex.com/Products/Modules/IO/MOD-IO2/resources/MOD-IO2+OLinuXino.zip (I suspect you already do but just in case).

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

Bernd

Hi Lub,

yes it is cool multimedia debugging. It has audio and visual (LED) feedback!

I'm sure you had good reasons implementing the SPI in software. I cannot imagine doing it for the fun of it. :)

Yes, I'm using the new version but the funny thing is that I got slighly better results using the old one, but still far from beeing usable.

Best Regards,
Bernd

iw2lsi

Hi

I'm in trouble too with mod-io2 and olinuxino a13 with R15 image...
the command "i2c-tool -w 0 0x048 4 0x02 0xa0 0x40 0x03"
ends with a "communication error on send"...

the first things I've notice is that UEXT seems to be on i2c-2, not i2c-0... is this right ?
anyway, giving the command "i2c-tool -w 2 0x048 4 0x02 0xa0 0x40 0x03"
ends with a "remote I/O error"... but this time I see the SCL and SDA line moving...

i2c-detect does not discover anything, and yes... the firmware on the pic is the latest

  thanks for any hints

               giampaolo

Bernd

Yes, you are right. For this board you have to use i2c-2.

I was able to use the i2c-detect and see the 0x48 device once after connecting the MOD-IO2. After that it was gone. Trying to send a command mostly resulted in i/o errors most of the time.

I have written my own basic firmware for the MOD-IO2 and that is working fine. If you have a PICKIT and want to give it a try, I can send you the HEX file.

iw2lsi

Hello Bernd

  thanks for the info... if you can send me your hex code, I'll be very happy and I'll test it.
  my mail is "iw2lsi at gmail dot com"

  I really hope, however, that olimex will provide a working source code for the mod-io2...

      thanks a lot

                Giampaolo

Bernd

Hi Giampaolo,

I will send it later today. With other boards the firmware from Olimex in the MOD-IO2 seems to work.

Cheers, Bernd