Seeed HM3301 verify issue

Hi everyone

Been trying to get this to work but following errors found

Any suggestions appreciated, thinking of taking fishing up instead…

For error : redeclaration of ‘NO_ERROR’ - try changing the NO_ERROR to ERROR_NONE in the enum and where used in the .h file. I am guessing that NO_ERROR is already used in Arduino.h or Wire.h.

Try rebuilding, if you still get the line 63 error: conflicting declaration then try changing the type name to error_t. Clearly you will also need to change occurrences of err_t to error_t.

Alternatively, you could try replacing #include “Arduino.h” and “Wire.h” with “Particle.h”? Sometimes things require the “Arduino.h” to build sometimes not and that might remove the conflict.

Thanks armor,

I’ll give it a try.

I have seen a reference on adafruit that the issue could be related to nRF52 incompatibility.

So may be in real trouble!

It should work if just an I2C device. Maybe need to re-write the driver software.

Hi armor

ERROR_NONE worked
error_t worked
i removed the “}err_t;” from below ERROR_OTHERS

So compiled i now get this

Many thanks

When you hit the SHOW RAW button you may get more info about the possible reasons for that error message.
(also showing that message - with its context - can help people round here)

However, I’d advise against using byte as a parameter name as it may well be used as a data type too (which would explain the error message) :wink:

Hi ScruffR

This is the RAW

Processing  iwseeedpstrial.ino
make -C ../modules/boron/user-part all
make[1]: Entering directory '/firmware/modules/boron/user-part'

mkdir -p target/
make -f ../../../modules/shared/nRF52840/build_linker_script.mk PREBUILD=1
make[2]: Entering directory '/firmware/modules/boron/user-part'
Creating target/platform_user_ram.ld ...
make[2]: Leaving directory '/firmware/modules/boron/user-part'

make -C ../../../user 
make[2]: Entering directory '/firmware/user'
Building cpp file: Seeed_HM330X.cpp
Invoking: ARM GCC CPP Compiler
mkdir -p ../build/target/user/platform-13-m
arm-none-eabi-gcc -DSTM32_DEVICE -DnRF52840 -DNRF52840_XXAA -DPLATFORM_THREADING=1 -DPLATFORM_ID=13 -DPLATFORM_NAME=boron -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD00D -DUSBD_PID_CDC=0xC00D -DSPARK_PLATFORM -g3 -gdwarf-2 -Os -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DINCLUDE_PLATFORM=1 -DSOFTDEVICE_PRESENT=1 -DS140 -DPRODUCT_ID=13 -DPRODUCT_FIRMWARE_VERSION=65535 -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"openthread-config-project.h\" -DENABLE_FEM=1 -DNRF_802154_PROJECT_CONFIG=\"openthread-platform-config.h\" -DRAAL_SOFTDEVICE=1 -D_WIZCHIP_=W5500 -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DLFS_CONFIG=lfs_config.h -DSYSTEM_VERSION_STRING=1.4.0 -DRELEASE_BUILD -I./inc -I../wiring/inc -I../system/inc -I../third_party/miniz/miniz -I../services/inc -I../third_party/nanopb/nanopb -I../communication/inc -I../hal/inc -I../hal/shared -I../hal/src/boron -I../hal/network/lwip/ublox -I../hal/src/nRF52840 -I../hal/src/armv7 -I../hal/src/nRF52840 -I../hal/src/nRF52840/lwip -I../hal/src/nRF52840/freertos -I../hal/src/nRF52840/openthread -I../hal/src/nRF52840/mbedtls -I../hal/src/nRF52840/littlefs -I../hal/network/api -I../hal/network/lwip -I../hal/network/lwip/posix -I../hal/network/openthread -I../hal/network/lwip/wiznet -I../hal/network/ncp -I../hal/network/ncp/at_parser -I../third_party/lwip/lwip/src/include -I../third_party/freertos/freertos/FreeRTOS/Source/include -I../third_party/nrf5_sdk/nrf5_sdk/external/freertos/portable/GCC/nrf52 -I../third_party/nrf5_sdk/nrf5_sdk/external/freertos/portable/CMSIS/nrf52 -I../third_party/openthread/openthread/include -I../third_party/openthread/openthread/src/core -I../third_party/openthread/openthread/examples/platforms -I../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio -I../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio/hal -I../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio/rsch -I../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio/rsch/raal -I../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio/rsch/raal/softdevice -I../third_party/wiznet_driver/wiznet_driver/Ethernet -I../gsm0710muxer/gsm0710muxer/include -I../platform/shared/inc -I../third_party/nrf5_sdk -I../third_party/nrf5_sdk/nrf5_sdk/components/toolchain/cmsis/include -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/drivers -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/drivers/include -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/hal -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/mdk -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/hal -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/drivers/src/prs -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/util -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140/headers -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140/headers/nrf52 -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/common -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/fstorage -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/experimental_section_vars -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/atomic -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/crc32 -I../third_party/nrf5_sdk/nrf5_sdk/integration/nrfx/legacy -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/delay -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/log -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/log -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/log/src -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/experimental_section_vars -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/atomic -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/delay -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/queue -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/common -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/mbr/nrf52840/headers -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140 -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140/headers -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140/headers/nrf52 -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/fifo -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/atomic_fifo -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/strerror -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/fstorage -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/atomic_flags -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/usbd -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/usbd/class/cdc -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/usbd/class/cdc/acm -I../third_party/nrf5_sdk/nrf5_sdk/components/ble/common -I../third_party/nrf5_sdk/nrf5_sdk/components/ble/nrf_ble_gatt -I../third_party/nrf5_sdk/nrf5_sdk/components/ble/ble_advertising -I../third_party/nrf5_sdk/nrf5_sdk/components/nfc/t2t_lib -I../third_party/nrf5_sdk/nrf5_sdk/components/nfc/platform -I../third_party/nrf5_sdk/nrf5_sdk/components/nfc/ndef/generic/message -I../third_party/nrf5_sdk/nrf5_sdk/components/nfc/ndef/generic/record -I../third_party/nrf5_sdk/nrf5_sdk/components/nfc/ndef/lauchapp -I../third_party/nrf5_sdk/nrf5_sdk/components/nfc/ndef/text -I../third_party/nrf5_sdk/nrf5_sdk/components/nfc/ndef/uri -I../third_party/nrf5_sdk/nrf5_sdk/external/nrf_cc310/include -I../third_party/nrf5_sdk/nrf5_sdk/external/utf_converter -I../third_party/littlefs/littlefs -I../platform/MCU/nRF52840/inc -I../dynalib/inc -I -I./libraries -I. -MD -MP -MF ../build/target/user/platform-13-mSeeed_HM330X.o.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -Wundef -DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -DSPARK_PLATFORM_NET=UBLOXSARA -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc  -DLOG_INCLUDE_SOURCE_INFO=1 -DPARTICLE_USER_MODULE -DUSER_FIRMWARE_IMAGE_SIZE=0x20000 -DUSER_FIRMWARE_IMAGE_LOCATION=0xD4000 -DMODULAR_FIRMWARE=1 -DMODULE_VERSION=6 -DMODULE_FUNCTION=5 -DMODULE_INDEX=1 -DMODULE_DEPENDENCY=4,1,1401 -DMODULE_DEPENDENCY2=0,0,0 -D_WINSOCK_H -D_GNU_SOURCE -DLOG_MODULE_CATEGORY="\"app\""  -fno-exceptions -fno-rtti -fcheck-new -std=gnu++14 -c -o ../build/target/user/platform-13-mSeeed_HM330X.o Seeed_HM330X.cpp
In file included from Seeed_HM330X.cpp:32:0:
Seeed_HM330X.h:82:1: error: multiple types in one declaration
 };
 ^
Seeed_HM330X.h:82:1: warning: 'typedef' was ignored in this declaration
Seeed_HM330X.cpp: In member function 'error_t HM330X::init()':
Seeed_HM330X.h:38:38: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
 #define CHECK_RESULT(a,b)   do{if(a=b)  {    \
                                      ^
Seeed_HM330X.cpp:50:5: note: in expansion of macro 'CHECK_RESULT'
     CHECK_RESULT(ret,select_comm());
     ^
Seeed_HM330X.cpp: In member function 'error_t HM330X::read_sensor_value(u8*, u32)':
Seeed_HM330X.cpp:59:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(data_len!=Wire.available())
                   ^
Seeed_HM330X.cpp:65:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<data_len;i++)
                  ^
Seeed_HM330X.cpp: In member function 'error_t IIC_OPRTS::IIC_read_byte(u8, u8*)':
Seeed_HM330X.cpp:136:13: warning: unused variable 'ret' [-Wunused-variable]
     error_t ret=ERROR_NONE;
             ^
Seeed_HM330X.cpp: In member function 'error_t IIC_OPRTS::IIC_read_16bit(u8, u16*)':
Seeed_HM330X.cpp:160:13: warning: unused variable 'ret' [-Wunused-variable]
     error_t ret=ERROR_NONE;
             ^
Seeed_HM330X.cpp: In member function 'error_t IIC_OPRTS::IIC_read_bytes(u8, u8*, u32)':
Seeed_HM330X.cpp:198:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(data_len!=Wire.available())
                   ^
Seeed_HM330X.cpp:205:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<data_len;i++)
                  ^
../build/module.mk:277: recipe for target '../build/target/user/platform-13-mSeeed_HM330X.o' failed
make[2]: *** [../build/target/user/platform-13-mSeeed_HM330X.o] Error 1
make[2]: Leaving directory '/firmware/user'
../../../build/recurse.mk:11: recipe for target 'user' failed
make[1]: *** [user] Error 2
make[1]: Leaving directory '/firmware/modules/boron/user-part'
../build/recurse.mk:11: recipe for target 'modules/boron/user-part' failed
make: *** [modules/boron/user-part] Error 2

Have you tried substituting byte with somethinge else which isn’t also a data type?

No, but I will try that

Cheers

If that doesn’t work you can post a SHARE THIS REVISION link here to allow others to compile your code.

Thanks for that, steep learning curve at the moment!!

https://go.particle.io/shared_apps/5da5f4c631209b000a0b9599

In your attempt to solve the error_t issue you have also commented out the terminating semicolon for that enum in line 64 (which we couldn’t see in your screenshot :wink: )

fat fingers, ive also just realised that i’ve connected a PMS5003 straight up to 6v. I was wondered why it had packed up!!!

If you actually want to use your local typedef for error_t you’d have to give it a name and then also use that everywhere in your code.

I’ve quickly corrected the errors I could find
https://go.particle.io/shared_apps/5da5f89931209b000a0b95d5

You can COPY THIS APP and see for yourself.
Can you report back once you have copied this so that I can remove it from my account again?

Wow, what can I say apart from thanks so much!!

I will test as soon as I can.

Cheers

I just realised there are some other instances where error_t needed replacing
https://go.particle.io/shared_apps/5da5fdaf31209b00050b9714

Again, many, many thanks.

I have just found an easier sketch for me to handle but it still needs the .h so …

Cheers

1 Like

Report is most excellent. Really quick and responsive sensor.

Just need to pick out the particle.publish info…

@davo101 is it possible to post this final project with the seeed HM3301 fully working?