Maxsonar Ez0 sensor does not compile with teensy

Status
Not open for further replies.

Balam

Active member
I am having compoiling errors with . Maxsonar-EZ0 sesnor.
it compiles with arduino - selecting arduino uno board
selecting teensy 3.x does not compile



using the sketch from
and library

https://www.maxbotix.com/articles/095.htm

https://github.com/felias-fogg/SoftI2CMaster

https://www.maxbotix.com/documents/Arduino Codes/I2C_for_MaxSonar.ino




error :


Arduino: 1.8.5 (Mac OS X), TD: 1.41, Board: "Teensy 3.2 / 3.1, Serial + MIDI, 96 MHz (overclock), Faster, US English"

Build options changed, rebuilding all
In file included from /var/folders/qc/b0k6l43j12126b25br1p92nw0000gn/T/arduino_modified_sketch_815964/sketch_feb12a.ino:22:0:
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h: In function 'void i2c_wait_scl_high()':
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h:204:39: error: '_SFR_IO_ADDR' was not declared in this scope
#define SCL_IN (_SFR_IO_ADDR(SCL_PORT) - 2)
^
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h:272:24: note: in expansion of macro 'SCL_IN'
: : [SCLIN] "I" (SCL_IN), [SCLPIN] "I" (SCL_PIN),
^
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h: In function 'bool i2c_init()':
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h:200:46: error: '_SFR_IO_ADDR' was not declared in this scope
#define SCL_DDR (_SFR_IO_ADDR(SCL_PORT) - 1)
^
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h:304:23: note: in expansion of macro 'SCL_DDR'
[SCLDDR] "I" (SCL_DDR), [SCLPIN] "I" (SCL_PIN),
^
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h: In function 'bool i2c_start(uint8_t)':
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h:199:46: error: '_SFR_IO_ADDR' was not declared in this scope
#define SDA_DDR (_SFR_IO_ADDR(SDA_PORT) - 1)
^
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h:327:25: note: in expansion of macro 'SDA_DDR'
: : [SDADDR] "I" (SDA_DDR), [SDAPIN] "I" (SDA_PIN),
^
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h: In function 'bool i2c_rep_start(uint8_t)':
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h:200:46: error: '_SFR_IO_ADDR' was not declared in this scope
#define SCL_DDR (_SFR_IO_ADDR(SCL_PORT) - 1)
^
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h:365:25: note: in expansion of macro 'SCL_DDR'
: : [SCLDDR] "I" (SCL_DDR), [SCLPIN] "I" (SCL_PIN),
^
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h: In function 'bool i2c_start_wait(uint8_t)':
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h:199:46: error: '_SFR_IO_ADDR' was not declared in this scope
#define SDA_DDR (_SFR_IO_ADDR(SDA_PORT) - 1)
^
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h:406:24: note: in expansion of macro 'SDA_DDR'
: : [SDADDR] "I" (SDA_DDR), [SDAPIN] "I" (SDA_PIN), [SDAOUT] "I" (SDA_OUT),
^
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h:411:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h: In function 'void i2c_stop()':
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h:200:46: error: '_SFR_IO_ADDR' was not declared in this scope
#define SCL_DDR (_SFR_IO_ADDR(SCL_PORT) - 1)
^
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h:441:25: note: in expansion of macro 'SCL_DDR'
: : [SCLDDR] "I" (SCL_DDR), [SCLPIN] "I" (SCL_PIN), [SCLIN] "I" (SCL_IN),
^
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h: In function 'bool i2c_write(uint8_t)':
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h:200:46: error: '_SFR_IO_ADDR' was not declared in this scope
#define SCL_DDR (_SFR_IO_ADDR(SCL_PORT) - 1)
^
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h:542:22: note: in expansion of macro 'SCL_DDR'
[SCLDDR] "I" (SCL_DDR), [SCLPIN] "I" (SCL_PIN), [SCLIN] "I" (SCL_IN),
^
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h: In function 'uint8_t i2c_read(bool)':
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h:200:46: error: '_SFR_IO_ADDR' was not declared in this scope
#define SCL_DDR (_SFR_IO_ADDR(SCL_PORT) - 1)
^
/Arduino/libraries/SoftI2CMaster-master/SoftI2CMaster.h:636:22: note: in expansion of macro 'SCL_DDR'
[SCLDDR] "I" (SCL_DDR), [SCLPIN] "I" (SCL_PIN), [SCLIN] "I" (SCL_IN),
^
Error compiling for board Teensy 3.2 / 3.1.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
 
Rewrite the sketch to use a different I2C library which is known to work on Teensy and its modern ARM architecture comprising I2C hardware support. It looks like this SoftI2C library does only work with old and outdated AVR stuff, especially the parts of code written in assembly language.
 
Last edited:
Status
Not open for further replies.
Back
Top