Jump to content
David_P

I2C interfacing with 8-bit(s)

Recommended Posts

Hi SteveS,

 

Beware: there is not a driver yet for SDX. I wrote a 'download the time from the RTC' tool for regular SpartaDos. I think it will work with SDX, but I did not test that!

Share this post


Link to post
Share on other sites

The module looks fine and I guess it should work.

 

Of course you'd have to modify the source code and change the I2C address and registers (which are different to the PCF I used in my example code).

 

so long,

 

Hias

Well, after several missteps I finally got it to work.

 

I have SCL on PA6 and SDA on PA7 so I had to edit Hias' i2c.src as well as the TBXL test program.

 

DS1307 has registers as follows: seconds, minutes, hours, day of week, day, month, year. All are in BCD format. Bit 7 of seconds set low starts the clock. High stop the clock.

 

@ProWizard

 

I found the RTC doesn't play nice with my converted mouse (PC bus mouse to ST pinout), no data.

 

Random movement with a joystick can reset the clock but paddle triggers don't. They do interrupt readings though if pressed.

 

I haven't any other controller types to test.

 

I guess I'll just leave the RTC at game port 2 but keep the mouse unplugged until needed.

 

-SteveS

Share this post


Link to post
Share on other sites

Random movements of the joystick can not reset my rtc since it is impossible to move Up and Down at the same time and these combinations are needed to control the rtc.

 

I though had issues with the touchtablet but I altered Atari-artist so that program works now with touchtablet in the other joystick port.

 

Another thing is that the wires from the pia to the rtc should be real short. If too long read/write disturbance with the rtc occurs.

 

According to an email conversation with guus assmann there are some components between pia and joystick port that better should be removed and some replaced with just a wire...

Share this post


Link to post
Share on other sites

Random movements of the joystick can not reset my rtc since it is impossible to move Up and Down at the same time and these combinations are needed to control the rtc.

 

I though had issues with the touchtablet but I altered Atari-artist so that program works now with touchtablet in the other joystick port.

 

Another thing is that the wires from the pia to the rtc should be real short. If too long read/write disturbance with the rtc occurs.

 

According to an email conversation with guus assmann there are some components between pia and joystick port that better should be removed and some replaced with just a wire...

[Edit] My clock resets only if Hias test program is looping but it's very repeatable. Rapidly moving the joystick in a circular motion does it every time. This joystick has large leaf switches so I suppose it is possible that all switches may momentarily be closed.

 

Is there any chance that the write bit gets set during an attempted read? I don't see how but clearly the clock is reset to all zeros.

 

The module is connected directly to the PIA but the only way I could shorten the leads is to install the module on the underside the 800XL's board.

Edited by a8isa1

Share this post


Link to post
Share on other sites

OK. I have new 800XL, after about a year of doing without, and I've got the DS1307/AT24C32 RTC module working again.

 

Anyone have any tips on how to take the DS1307's BCD data or an ASCII time-date string and inject it into SDX's system clock?

 

-SteveS

Share this post


Link to post
Share on other sites

I'm making a little progress.

 

I found some documentation on my HDD regarding ZHAND.COM. I also learned that Z.SYS is recent replacement for ZHAND.COM.

 

Unfortunately, I'm having problems with Z.SYS installed. Testing from BASIC I can open the Z: device, do XIO 36 (or 37) without error but when I do PUT #1,data I immediately get error 139.

 

The progress I spoke of is if I use the old ZHAND.COM instead of Z.SYS I'm able to set the SDX time and date from BASIC.

 

I still need to put the step of reading my RTC module together with the step of setting SDX's system clock.

 

-SteveS

Share this post


Link to post
Share on other sites

I dropped the Z: handler all together. Discarded some older notes I had on setting SpartaDOS clock. I learned how to use VSETTD. I also finally noticed that $FFCE should have read $FFC3. Now I can update the SpartaDOS clock and SDX clock (if JIFFY.SYS is installed).

 

I probably won't learn how to write a proper driver for SDX but this is good enough for my needs.

 

Now I want to revisit a problem I thought I had a year or so ago and can confirm now.

 

To recap, I purchased an Arduino RTC breakout module (DS1307 based) and adapted Hias I2C TBXL test program to communicate with it. I mounted the module internal to my 800XL connected directly to the PIA (pins 6 and 7, PA4 and PA5).

 

With Hias' test program I noticed that if I rapidly moved a joystick in random fashion while the test program is running it would intermittently scramble the data on the DS1307. Values would go out of range and essentially halt its time keeping ability.

 

After adapting hias BASIC interface for his I2C stack to Action! and creating a display clock I noticed that scrambling the DS1307's data was no longer intermittent. It can be done instantly by moving the joystick.

 

If I'm not running Hias test program or my display clock program then no amount of joystick movement seems to corrupt the clock.

 

I'm hazzarding a guess here. While polling the clock repetetively and moving the joystick in a random fashion the SDA line might be getting pulled low at just the right time as to not scramble the slave address (for the DS1307) but is at the right time to pull the R/W bit low, changing a read request into a write request.

 

Does this sound plausible?

 

Is there an easy fix to avoid the problem (other than not touching the joystick)?

 

-SteveS

Edited by a8isa1

Share this post


Link to post
Share on other sites

With Hias' test program I noticed that if I rapidly moved a joystick in random fashion while the test program is running it would intermittently scramble the data on the DS1307. Values would go out of range and essentially halt its time keeping ability.

I couldn't reproduce this with the PCF8583 connected externally.

 

I plugged Guus' PCF8583 board into joystick port 2 and a joystick into port 1 and then ran the PCF8583.TUR test program. Moving the joystick didn't have an effect on the RTC time printed to screen.

 

I'm not sure what's going wrong with your setup. Of course, having a joystick plugged into port 2 would explain such behaviour, but since joystick port 1 uses different PIA pins it shouldn't interfere with port 2.

 

BTW: do you have a digital scope? If yes, check the port A PIA pins 6 and 7 while moving the joystick to see if there's any interference.

 

so long,

 

Hias

Share this post


Link to post
Share on other sites

I couldn't reproduce this with the PCF8583 connected externally.

 

I plugged Guus' PCF8583 board into joystick port 2 and a joystick into port 1 and then ran the PCF8583.TUR test program. Moving the joystick didn't have an effect on the RTC time printed to screen.

 

I'm not sure what's going wrong with your setup. Of course, having a joystick plugged into port 2 would explain such behaviour, but since joystick port 1 uses different PIA pins it shouldn't interfere with port 2.

 

BTW: do you have a digital scope? If yes, check the port A PIA pins 6 and 7 while moving the joystick to see if there's any interference.

 

so long,

 

Hias

Hias, thanks for replying.

 

The joystick was plugged into port 2

 

I'm not going to worry about the issue because I don't normally keep a joystick plugged into that port and even if I plug one in it won't affect the RTC while playing games.

 

-SteveS

Share this post


Link to post
Share on other sites

Hi Guys,

 

If anyone is interested with I2c and Atari 8 bit I made the interface with PCF8584 (Parallel-bus to I²C-bus protocol converter and interface). Now we may to connect any I2C device to Atari directly via 8-bit parallel bus.

English topic:

https://systemembedded.eu/viewtopic.php?f=28&t=32

 

Polish topic and discussion:

http://www.atari.org.pl/forum/viewtopic.php?id=15082

 

Have fun!

  • Like 7

Share this post


Link to post
Share on other sites

Hello Pancio

 

Will it share the parallelbus with other PBI devices that are able to?

How does it connect to the PBI? I don't see any numbers on the PCB.

Do you have some kind of manual, that tells us how to connect it and how we are supposed to use it?

I can't find it via the "seeed" link, the other one is fine.

 

Sincerely

 

Mathy

Share this post


Link to post
Share on other sites

Very cool!

 

I've wondered what other I2C devices I could connect but assumed that bit banging via PIA would be too slow to use anything like say an LCD. I didn't have to worry about speed or gobs of data with the RTC I have connected.

 

I don't even know what other I2C devices are available.

 

I'm excited about your project!

Edited by a8isa1

Share this post


Link to post
Share on other sites

Hi Mathy,

 

Yes, my interface is connected directly to parallel bus and can be addressed by use any address from D58X. Of course, you may to address it by using D18X, doesn't matter. You may connect it to PBI, but D5XX signal you should connect from Cartridge socket or from Atari motherboard directly. So you may use other devices connected to PBI if those were configured with other addresses. The first version of my interface is independent and you may use it into all Atari (but you must provide any signal from motherboard) . For your information, I planned to make the CART/ECI version but I'm not sure regarding PBI (I haven't specific ISA socket). Every important information you may check on schematic... I'll prepare some guide if you want.

 

For clarify:

PCB version 1.1:

http://dirtypcbs.com/store/designer/details/pancio/5998/atari-8-bit-i2c-interface

 

PCB version 2.1

https://www.seeedstudio.com/Atari-8-bit-I2C-Interface-A2I2-g-1127014

 

Regards,

pancio

  • Like 3

Share this post


Link to post
Share on other sites

Very cool!

 

Thanks to Hias Reichl's I2C driver written long ago I've been able to connect and use a DS3231 clock module which connected to PIA and set SDX's clock. I've wondered what other I2C devices I could connect but assumed that bit banging via PIA would be too slow to use anything like say an LCD. I didn't have to worry about speed or gobs of data with an RTC.

 

I don't even know what other I2C devices are available.

 

many...

 

I started with PCF8574 (Remote 8-Bit I/O Expander for I 2 C Bus) - very popular in the eBay market as completely assembled module. I wrote software which can write and read values to/from PCF8574 register just only for test but I've idea to write driver for LCD display (with HD44780 controller). We may use any I2C device like Bosh BHT280 in order to read temperature, pressure and others... can imagine? :-)

 

Regards,

 

  • Like 1

Share this post


Link to post
Share on other sites

Hello Pancio

 

The SCART connector also has I2C. It's used to sync TV and video, so both have the same channels on the same numbers. I'm not sure if that can be used for anything useful this days, but it sure would be fun to change the order of the channels using the Atari 8 bit computer.

 

Sincerely

 

Mathy

Share this post


Link to post
Share on other sites

 

 

many...

 

I started with PCF8574 (Remote 8-Bit I/O Expander for I 2 C Bus) - very popular in the eBay market as completely assembled module. I wrote software which can write and read values to/from PCF8574 register just only for test but I've idea to write driver for LCD display (with HD44780 controller). We may use any I2C device like Bosh BHT280 in order to read temperature, pressure and others... can imagine? :-)

 

Regards,

 

 

Yes, I can imagine. The DS3231 has a temperature sensor built into it but since the module is inside my 800XL it normally reads 90 Degrees F.

 

I can plug another module into a joystick port and place the module in more useful place for measuring temperature

Share this post


Link to post
Share on other sites

Hello Pancio

 

Every important information you may check on schematic... I'll prepare some guide if you want.

 

Yes, please do. Not everybody can read a schematic.

 

Sincerely

 

Mathy

Share this post


Link to post
Share on other sites

The SCART connector also has I2C. It's used to sync TV and video, so both have the same channels on the same numbers. I'm not sure if that can be used for anything useful this days, but it sure would be fun to change the order of the channels using the Atari 8 bit computer.

 

I've never heard about I2C on SCART. Yes, it's true that we have D2B but I have no knowledge regarding this protocol (Is it compatible with I2C?). Anyway, I though rather connect Atari to many other sensors/devices like power meter, gyroscope or small OLED screen and finally make something like AtariPi :-). As you requested, I'll prepare short user guide soon.

 

 

 

Yes, I can imagine. The DS3231 has a temperature sensor built into it but since the module is inside my 800XL it normally reads 90 Degrees F.

 

I can plug another module into a joystick port and place the module in more useful place for measuring temperature

 

Great, I'm looking for persons which can to develop and support any kinds of sensors. I may develop the hardware and some parts of software but I haven't so much time in order to create drivers for all of I2C devices. Are you willing to help me? I may sell the prototype PCB...

 

 

Sincerely

 

pancio

Share this post


Link to post
Share on other sites

Hello Pancio

 

 

Yes, please do. Not everybody can read a schematic.

 

Sincerely

 

Mathy

 

You may find the small guide on my page. If something will be not so clearly - let me know.

 

Sincerely

pancio,

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...