RTC I2C crash

28 views
Skip to first unread message

Cam

unread,
Jun 19, 2015, 12:27:10 PM6/19/15
to solde...@googlegroups.com
Hi Paul,

Looks like we (Iain) found the other instability source which is detailed out here: http://www.forward.com.au/pfod/ArduinoProgramming/I2C_ClearBus/index.html

I'm wondering if its best to take care of this in the firmware RTC driver or simply in CoreBasic.... in which case might I ask what might the elegant code solution look like?

Cheers,

Cam

Paul Curtis

unread,
Jun 19, 2015, 2:29:01 PM6/19/15
to solde...@googlegroups.com
Do it in CB before installing and I2C device.

Looking at the description, this may work, it’s just a sketch — change SDA and SCL to the pins that you have connected as an I2C bus:

WAIT 2.5
PIN [SCL, SDA] AS INPUT 
IF PIN SCL = 0 THEN THROW -1 : rem can’t become master
I = 0
WHILE I < 0 AND PIN SDA = 0
  PIN SCL AS OUTPUT
  PIN SCL = 0 : WAIT 0.01
  PIN SCL = 1 : WAIT 0.01
  I = I + 1
WEND
IF PIN SDA = 0 THEN THROW -1
PIN SDA AS OUTPUT
PIN SDA = 0
WAIT 0.01
PIN SDA = 1
WAIT 0.01
PIN [SCL, SDA] AS INPUT

— Paul.

--
--
You received this message because you are subscribed to the Google
Groups "SolderCore" group http://groups.google.com/group/soldercore?hl=en

---
You received this message because you are subscribed to the Google Groups "SolderCore" group.
To unsubscribe from this group and stop receiving emails from it, send an email to soldercore+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cam

unread,
Jun 20, 2015, 8:04:19 AM6/20/15
to solde...@googlegroups.com

Hi Paul,

 

Many thanks, as always a great help – testing now, fingers crossed.

 

Also, wondering if you have any plans to release a firmware update that includes some of the stuff you have been working on including the updated MCP322x driver?

 

Cheers,

 

Cam

Paul Curtis

unread,
Jun 20, 2015, 11:10:55 AM6/20/15
to solde...@googlegroups.com
Henry is working on it. 

--
Paul Curtis

Cam

unread,
Jun 22, 2015, 4:38:19 PM6/22/15
to solde...@googlegroups.com

Great news – thanks Paul, hopefully it will be ready soon?

Paul Curtis

unread,
Jun 23, 2015, 2:20:54 AM6/23/15
to solde...@googlegroups.com
I have no idea, I am in Germany for two weeks, in the Uk for a couple of days, and then back to Germany for two weeks.

Regards,

— Paul.

Cam

unread,
Jun 24, 2015, 12:01:38 PM6/24/15
to solde...@googlegroups.com

Hi Paul,

 

One more question, where can I read more about THROW and how to use it please, its not in the manual :-)

Paul Curtis

unread,
Jun 24, 2015, 12:39:57 PM6/24/15
to solde...@googlegroups.com
THROW terminates the application if not caught; you can possibly (I forget) use THROW with a TRY clause when the TRY calls a subroutine.  I used it only by way of example.

If it’s not documented, likely it doesn’t work in all cases.

— Paul.

Cam

unread,
Jun 24, 2015, 4:16:44 PM6/24/15
to solde...@googlegroups.com

OK, thanks Paul…. I will look at how this can work.

Paul Curtis

unread,
Jun 24, 2015, 4:20:26 PM6/24/15
to solde...@googlegroups.com
…or use a global and set it in a called function and don’t use THROW, use RETURN.

— Paul.

Cam

unread,
Jun 24, 2015, 4:26:47 PM6/24/15
to solde...@googlegroups.com

Guten Abend Paul – many thanks, I will use that approach.

Reply all
Reply to author
Forward
0 new messages