Hello,
I'd like to use an I2C communication protocol on an Atmega328 with FF. For this purpose I loaded the file i2c-base-avr.txt to the chip. I succeeded to initialize the I2C bus and adress the slave device either for reading or writing, but for some reasons it's not possible to exchange bytes using the i2c.c! command. Are there other words required for the I2C communication? What baudrate is recommended for I2C?
Additionally we have the problem, that after executing some commands (e.g. i2c.ping?), FF cannot be operated any more probably because it is waiting for something.
How could we improve the I2C communication?
Thanks for your support.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I added watchdog functionality to the Atmega code.
With 7 WD+ , the watchdog will timeout in 2 seconds and reset the chip.
By calling PAUSE or CWD in the loops you can kick the dog and prevent the watchdog reset.
Since the I2C words do not kick the dog, a watchdog reset will occur if the I2C hangs.
After restart of FF, the watchdog is disabled, so you have to enable it yourself if you want to use the watchdog.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Still not working :-(
It now does not time out but still does not get past 07 on the 1st line of the table.
Should I be getting an empty table when nothing is connected to the bus?
On a fresh install (on arduino nano) I am just adding i2c-base and i2c.detect, Do I need anything else?
sorry for the noob questions, I am new to forth & i2c
Cheers
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I'd like to use an I2C communication protocol on an Atmega328 with FF. For this purpose I loaded the file i2c-base-avr.txt to the chip. I succeeded to initialize the I2C bus and adress the slave device either for reading or writing, but for some reasons it's not possible to exchange bytes using the i2c.c! command. Are there other words required for the I2C communication? What baudrate is recommended for I2C?
Additionally we have the problem, that after executing some commands (e.g. i2c.ping?), FF cannot be operated any more probably because it is waiting for something.
How could we improve the I2C communication?
Thanks for your support.
Hi,
I added watchdog functionality to the Atmega code.
With 7 WD+ , the watchdog will timeout in 2 seconds and reset the chip.
By calling PAUSE or CWD in the loops you can kick the dog and prevent the watchdog reset.
Since the I2C words do not kick the dog, a watchdog reset will occur if the I2C hangs.
After restart of FF, the watchdog is disabled, so you have to enable it yourself if you want to use the watchdog.
Hi,
Complete aricle online here:
Watchdog management on ARDUINO with FlashForth
https://arduino-forth.com/article/FORTH_FlashForth_development_manageWatchdog
Hi,
I'm using the latest versions of i2c base and i2c detect but still having issues.
With nothing connected on the bus I get the following output...
i2c.init ok<#,ram>
i2c.detect
00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
00 : W FlashForth 5 ATmega328 19.11.2022
This is after adding a CWD in each loop.
Any advice please?
Cheers
Where did you add CWD ? It must be added to I2C.WAIT. Works for me.
I added to i2c.detect, will try your suggestion, thanks
Still not working :-(
It now does not time out but still does not get past 07 on the 1st line of the table.
Should I be getting an empty table when nothing is connected to the bus?
On a fresh install (on arduino nano) I am just adding i2c-base and i2c.detect, Do I need anything else?
sorry for the noob questions, I am new to forth & i2c
Cheers
OK, it works if I have a device attached :-)
Just seems to hang with nothing on the bus.
I can carry on now I know the address :-)
You need at least the pullup resistors
on the bus to prevent the hanging.