ESP8266+ATECC508A

I need to follow this tutorial: https://mongoose-os.com/blog/mongoose-esp8266-atecc508-aws/

But I'm stuck here:
✔ bernardo ⮀ ~ ⮀
❯ cd mongoose-os/fw/examples/c_mqtt [11:01:59]
✔ bernardo ⮀ ⭠ master± ⮀ ~/mongoose-os/fw/examples/c_mqtt ⮀
❯ mos build --arch esp8266 [11:02:06]
Connecting to http://mongoose.cloud, user test
Uploading sources (3040 bytes)
Success, built c_mqtt/esp8266 version 1.0 (20170301-140258/???).
Firmware saved to build/fw.zip
✔ bernardo ⮀ ⭠ master± ⮀ ~/mongoose-os/fw/examples/c_mqtt ⮀
❯ mos flash [11:03:06]
Loaded c_mqtt/esp8266 version 1.0 (20170301-140258/???)
Opening /dev/ttyUSB0...
Connecting to ESP8266 ROM, attempt 1 of 10...
Connected
Running flasher @ 460800...
Flasher is running
Flash size: 4194304, params: 0x0240
Deduping...
2544 @ 0x0 -> 0
547808 @ 0x11000 -> 3040
131072 @ 0xdb000 -> 0
128 @ 0x3fc000 -> 0
Writing...
4096 @ 0x1000
4096 @ 0x96000
4096 @ 0xfb000
Wrote 12288 bytes in 0.30 seconds (318.86 KBit/sec)
Verifying...
2544 @ 0x0
4096 @ 0x1000
547808 @ 0x11000
131072 @ 0xdb000
4096 @ 0xfb000
128 @ 0x3fc000
Booting firmware...
All done!
✔ bernardo ⮀ ⭠ master± ⮀ ~/mongoose-os/fw/examples/c_mqtt ⮀
❯ mos aws-iot-setup [11:03:12]
Failed to get default AWS region, please specify --aws-region
Error: AWS region not specified
✘ bernardo ⮀ ⭠ master± ⮀ ~/mongoose-os/fw/examples/c_mqtt ⮀
❯ mos aws-iot-setup --aws-region us-east-1 [11:03:17]
AWS region: us-east-1
Connecting to the device...
Current MQTT config: {
"clean_session": true,
"keep_alive": 60,
"pass": "",
"pub": "/response",
"reconnect_timeout_max": 60,
"reconnect_timeout_min": 10,
"server": "broker.mqttdashboard.com:1883",
"ssl_ca_cert": "",
"ssl_cert": "",
"ssl_cipher_suites": "",
"ssl_key": "",
"ssl_psk_identity": "",
"ssl_psk_key": "",
"sub": "/request",
"user": "",
"will_message": "",
"will_topic": ""
}
AWS region: us-east-1
Error: failed to generate certificate: AccessDeniedException: User: arn:aws:iam::022994461706:user/data.traffic is not authorized to perform: iot:ListPolicies on resource: *
status code: 403, request id: d426527b-fe87-11e6-bd33-c111ce281632

«1

Comments

  • SergeySergey Dublin, Ireland
    edited March 1

    Seems like you have wrong AWS credentials.
    Open ~/.aws/credentials and make sure they are correct.

    See http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html on how to get AWS credentials.

  • bernardoaraujorbernardoaraujor goiania
    edited March 1

    I did the following (open in a new tab for zoom):

    screenshot of my IAM Management Console

    ✔ bernardo ⮀ ~ ⮀
    ❯ sudo rm .aws/credentials [13:03:13]
    [sudo] password for bernardo:
    ✘ bernardo ⮀ ~ ⮀
    ❯ mos aws-iot-setup --aws-region us-east-1 [13:04:31]
    AWS region: us-east-1

    AWS credentials are missing. If this is the first time you are running this tool,
    you will need to obtain AWS credentials from the AWS console as explained here:
    http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html

    Would you like to enter them now [y/N]? y
    Access Key ID: AKIAJIVZ42FDEGFPLG2A
    Secret Access Key: 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
    Wrote credentials to: /home/bernardo/.aws/credentials
    Connecting to the device...
    Current MQTT config: {
    "clean_session": true,
    "keep_alive": 60,
    "pass": "",
    "pub": "/response",
    "reconnect_timeout_max": 60,
    "reconnect_timeout_min": 10,
    "server": "broker.mqttdashboard.com:1883",
    "ssl_ca_cert": "",
    "ssl_cert": "",
    "ssl_cipher_suites": "",
    "ssl_key": "",
    "ssl_psk_identity": "",
    "ssl_psk_key": "",
    "sub": "/request",
    "user": "",
    "will_message": "",
    "will_topic": ""
    }
    AWS region: us-east-1
    Error: failed to generate certificate: AccessDeniedException: User: arn:aws:iam::022994461706:user/data.traffic is not authorized to perform: iot:ListPolicies on resource: *
    status code: 403, request id: cf3f12b1-fe98-11e6-a805-bb70880f9347

  • rojerrojer Dublin, Ireland
    edited March 1

    it seems to me that your user account lacks the necessary privileges to list policies.

    we list policies to populate the dropdown. but it's likely that you don't have other necessary permissions to proceed as well. data.traffic seems like a weird account name - are you using some service account and not your personal one?

    anyway, make sure the account has all the necessary permissions, such as:

                    "iot:CreateCertificateFromCsr",
                    "iot:AttachPrincipalPolicy",
    

    in addition to the already mentioned iot:ListPolicies.

  • bernardoaraujorbernardoaraujor goiania
    edited March 1

    I'm sorry about the data.traffic account name.

    I'm actually studying Mongoose OS because I'm a Hardware Engineer at Data Traffic, a Brazilian company that specializes in Intelligent Road Traffic Control.
    I'm trying to set up ESP8266+ATECC508A so I can prove to my team whether your technology can be useful in our field of applications.

    But I still have a few doubts:

    I'm not sure I understand what you mean by "populate the dropdown" though.
    Could you elaborate more on that?

    Also, I'm still a bit confused about the user permissions.

    I only want to make my ESP8266 + ATECC508A connect to AWS. Which permissions do I need to set for the data.traffic user?

  • rojerrojer Dublin, Ireland

    certificate needs a security policy to be attached to it. our UI has a dropdown list of policies currently in existence that it offers you to select from, or create a default one. it looks like operation to list policies is what is failing here, and the error suggests that data.traffic account has extremely limited iot:* permissions that do not allow it to even list IoT policies.
    i have never seen this happen, so you must have a somewhat peculiar setup. perhaps you can ask someone familiar with AWS in your company about this error?

  • bernardoaraujorbernardoaraujor goiania
    edited March 1

    I guess I need to set something up at this page?

    There are too many options and I don't know which I should choose.
    I only want to set up ESP8266+ATECC508A so I can prove to my team whether your technology can be useful in our field of applications.

    enter image description here

  • rojerrojer Dublin, Ireland

    yes, you are on the right track. the simplest is to give data.traffic all iot:* permissions. you can do that with a simple policy document (use "create policy" button):

    {
      "Version": "2012-10-17",
      "Statement": [
        {"Effect": "Allow", "Action": "iot:*", "Resource": "*"}
      ]
    }
    

    before trying to set up a device, verify that aws iot list-policies command works.

  • Alright I chose "Power User Access" and the command seems to have worked.

  • rojerrojer Dublin, Ireland

    thanks, good to know.

  • Where should I type aws iot list-policies?
    Into mos console or bash?

  • rojerrojer Dublin, Ireland

    that's bash command using the AWS CLI tool.
    but don't bother, if device setup works that's all you need.

  • How do I connect the device to my AWS IoT Dashboard?

  • rojerrojer Dublin, Ireland

    can you confirm that with the new permissions the device setup process worked to completion?

  • ✘ bernardo ⮀ ~ ⮀
    ❯ mos aws-iot-setup --aws-region us-east-1 --aws-iot-policy mos-default [16:57:10]
    AWS region: us-east-1
    Connecting to the device...
    Current MQTT config: {
    "clean_session": true,
    "keep_alive": 60,
    "pass": "",
    "pub": "/response",
    "reconnect_timeout_max": 60,
    "reconnect_timeout_min": 10,
    "server": "a3mwmjlzhx4wzb.iot.us-east-1.amazonaws.com:8883",
    "ssl_ca_cert": "ca-verisign-ecc-g2.crt.pem",
    "ssl_cert": "aws-iot-9145b780b0.crt.pem",
    "ssl_cipher_suites": "",
    "ssl_key": "aws-iot-9145b780b0.key.pem",
    "ssl_psk_identity": "",
    "ssl_psk_key": "",
    "sub": "/request",
    "user": "",
    "will_message": "",
    "will_topic": ""
    }
    Generating certificate request, CN: mos-23SENSJUP3Q9TF94
    Generating private key locally
    Asking AWS for a certificate...
    Certificate ID: 1dd6b2735580d6eca5a097e2555e59b0d9c5d16f5e7d097e18b38d53afd9d6e6
    Certificate ARN: arn:aws:iot:us-east-1:022994461706:cert/1dd6b2735580d6eca5a097e2555e59b0d9c5d16f5e7d097e18b38d53afd9d6e6
    Wrote private key to aws-iot-1dd6b27355.key.pem
    Wrote certificate to aws-iot-1dd6b27355.crt.pem
    AWS region: us-east-1
    Attaching policy "mos-default" to the certificate...
    Uploading certificate...
    Uploading key...
    Uploading CA certificate...
    New config: {
    "clean_session": true,
    "keep_alive": 60,
    "pass": "",
    "pub": "/response",
    "reconnect_timeout_max": 60,
    "reconnect_timeout_min": 10,
    "server": "a3mwmjlzhx4wzb.iot.us-east-1.amazonaws.com:8883",
    "ssl_ca_cert": "ca-verisign-ecc-g2.crt.pem",
    "ssl_cert": "aws-iot-1dd6b27355.crt.pem",
    "ssl_cipher_suites": "",
    "ssl_key": "aws-iot-1dd6b27355.key.pem",
    "ssl_psk_identity": "",
    "ssl_psk_key": "",
    "sub": "/request",
    "user": "",
    "will_message": "",
    "will_topic": ""
    }
    Setting new configuration...
    Saving and rebooting...

  • rojerrojer Dublin, Ireland

    yes, this looks ok. now configure wifi on the device (if you haven't already) and run mos console. it should connect to wifi and then to AWS MQTT, whowing MQTT Connect(1) at the end.

  • The device seems to be connected.
    But I still can't see it in my AWS IoT Dashboard.

    ✘ bernardo ⮀ ~ ⮀
    ❯ mos console [17:17:48]
    ip:192.168.0.190,mask:255.255.255.0,gw:192.168.0.1
    mgos_wifi_on_change_ WiFi: ready, IP 192.168.0.190
    mqtt_global_connect MQTT connecting to a3mwmjlzhx4wzb.iot.us-east-1.amazonaws.com:8883
    mongoose_poll New heap free LWM: 33000
    mongoose_poll New heap free LWM: 32792
    SW ECDSA verify curve 3 hash_len 32 sig_len 70
    SW ECDSA verify curve 3 hash_len 32 sig_len 71
    ATCA is not available (-20096), using sw ECDH
    mongoose_poll New heap free LWM: 20008
    pm open,type:2 0
    ev_handler MQTT Connect (1)
    ev_handler Subscribing to 'test/rpc'
    ev_handler Subscribing to 'test/rpc/#'
    ev_handler CONNACK: 0
    sub Subscribed to /request

  • rojerrojer Dublin, Ireland

    yes, AWS connection works. however, it doesn't actually use crypto chip.
    to make it use ATECC508, you need to pass --use-atca to aws-iot-setup.
    i know the blog post says it will be autodetected - sorry, this is not the case, it should be corrected. try mos aws-iot-setup --aws-region us-east-1 --aws-iot-policy mos-default --use-atca now.

  • rojerrojer Dublin, Ireland

    if the chip is brand new, you may need to configure it first.
    do step 2 from this procedure (ignore the stuff about generating certs, aws-iot-setup will do that for you, but the chip needs to be configured).

  • bernardoaraujorbernardoaraujor goiania
    edited March 1

    I haven't configured the ATECC508A yet.

    I reckon mos aws-iot-setup created aws-iot-1dd6b27355.key.pem and aws-iot-1dd6b27355.crt.pem
    Will I use these in the process?

    But I'm still a bit confused about which steps to take and which to ignore.

  • rojerrojer Dublin, Ireland
    edited March 1

    those are existing certificate and key that were created by the setup process. don't worry about them, new pair will be generated in the chip once you have it running.

    first, we need to get the chip recognized and configured.
    i'm assuming you have it connected as explained in the post, so now please do the following:

    mos config-set i2c.enable=true sys.atca.enable=true

    run mos console, reboot the device and you should see:

    ...
    mgos_i2c_create      I2C GPIO init ok (SDA: 12, SCL: 14)
    mgos_atca_init       ATECC508 @ 0x60: rev 0x5000 S/N 0x123bdf459e9b50ee, zone lock status: yes, yes; ECDH slots: 0x0c
    ...
    

    except in you case zone lock status will probably be "no, no" if the chip is not configured yet.
    please let me know when you get this working.

  • Hey Rojer, how are you doing today?

    I ran mos config-set i2c.enable=true sys.atca.enable=true.
    I didn't run any step from this link yet.
    Now when I open mos console, it keeps printing this in a loop.
    I guess my chip is not well connected to my NodeMCU?

    ✔ bernardo ⮀ ~ ⮀
    ❯ mos console [10:37:27]
    scandone
    del if0
    usl

    ets Jan 8 2013,rst cause:2, boot mode:(3,1)

    load 0x40100000, len 1720, room 16
    tail 8
    chksum 0xe7
    load 0x3ffe8000, len 784, room 0
    tail 0
    chksum 0xd0
    !�� � �n��r��n|� �lrl��r�l��mode : sta(18:fe:34:f9N(�rA�Q*!!�� �I-A%��-!E�!� -�Q�Any+!�v-I-9� �YNQ 5Y
    esp_mgos_init2 c_mqtt 1.0 (20170301-140258/???)
    esp_mgos_init2 Mongoose OS Firmware 2017030114 (20170301-140258/???)
    esp_mgos_init2 SDK 2.0.0(656edbf), RAM: 49224 total, 46100 free
    esp_print_reset_info Reset cause: 4 (soft reset)
    fs_mount Mounting FS: 131072 @ 0xdb000
    mgos_sys_config_init MAC: 1AFE34F90E39
    mgos_sys_config_init WDT: 30 seconds
    scandone
    del if0
    usl
    mode : null
    mgos_wifi_set_mode WiFi mode: STA
    mode : sta(18:fe:34:f9:0e:39)
    add if0
    mgos_wifi_setup_sta WiFi STA: Connecting to ped
    mgos_i2c_create I2C GPIO init ok (SDA: 12, SCL: 14)
    mgos_atca_init Failed to get info
    esp_mgos_init2 MG init error: -20
    esp_mgos_init Init failed: -20
    scandone
    del if0
    usl

  • rojerrojer Dublin, Ireland

    mgos_atca_init Failed to get info

    Looks like chip is not connected correctly, or maybe address is incorrect.
    Are you using standalone chip or ATCRYPTOAUTH-XPRO board from the kit?

  • bernardoaraujorbernardoaraujor goiania
    edited March 2

    I'm using a standalone chip.
    I'm assuming the dot in "º6EAV" means pin 1, and the pins follow this order (taken from Atmel-8923S-CryptoAuth-ATECC508A-Datasheet-Summary.pdf):

    taken from Atmel-8923S-CryptoAuth-ATECC508A-Datasheet-Summary

    This is how the pins are connected:
    ATECC508A-----NodeMCU
    4------------------------GND
    5------------------------D6
    6------------------------D5
    8------------------------3V3

    enter image description here

    enter image description here

  • rojerrojer Dublin, Ireland

    hm. this looks a-ok to me. not the best soldering job in the world, but should work.
    please double-check that the chip actually gets 3.3V - i notice that LED is not on when i think it's supposed to be, given how it's plugged.

    then, try also setting debug.level=3 i2c.debug=true, it should print more info.

  • The weird combination of flash + angle of the picture made the LED look off.
    But it is actually on.

    ✘ bernardo ⮀ ~ ⮀
    ❯ mos config-set debug.level=3 i2c.debug=true [11:26:18]
    Getting configuration...
    Error: Device handshake timeout
    ✘ bernardo ⮀ ~ ⮀
    ❯ mos console [11:26:35]
    nfo
    esp_mgos_init2 MG init error: -20
    esp_mgos_init Init failed: -20
    scandone
    del if0
    usl

    ets Jan 8 2013,rst cause:2, boot mode:(3,6)

    load 0x40100000, len 1720, room 16
    tail 8
    chksum 0xe7
    load 0x3ffe8000, len 784, room 0
    tail 0
    chksum 0xd0
    csum 0xd0� @�y.=B5H�@mIhp��p�+�I�q�y" jrAea*!!��A�N(�rA�Q
    !�� � �n��r��n|� �lrl��r�l��mode : sta(18:fe:34:f9
    esp_mgos_init2 c_mqtt 1.0 (20170301-140258/???)
    esp_mgos_init2 Mongoose OS Firmware 2017030114 (20170301-140258/???)
    esp_mgos_init2 SDK 2.0.0(656edbf), RAM: 49224 total, 46100 free
    esp_print_reset_info Reset cause: 4 (soft reset)
    fs_mount Mounting FS: 131072 @ 0xdb000
    mgos_sys_config_init MAC: 1AFE34F90E39
    mgos_sys_config_init WDT: 30 seconds
    scandone
    del if0
    usl
    mode : null
    mgos_wifi_set_mode WiFi mode: STA
    mode : sta(18:fe:34:f9:0e:39)
    add if0
    mgos_wifi_setup_sta WiFi STA: Connecting to ped
    mgos_i2c_create I2C GPIO init ok (SDA: 12, SCL: 14)
    mgos_atca_init Failed to get info
    esp_mgos_init2 MG init error: -20
    esp_mgos_init Init failed: -20
    scandone
    del if0
    usl

  • rojerrojer Dublin, Ireland
    Getting configuration...
    Error: Device handshake timeout
    

    yes, you won't be able to set settings because device is failing to boot at present. so, reflash and set all the settings at once:

    mos config-set i2c.enable=true sys.atca.enable=true debug.level=3 i2c.debug=true
    
  • ✔ bernardo ⮀ ~ ⮀
    ❯ cd mongoose-os/fw/examples/c_mqtt [11:36:30]
    ✔ bernardo ⮀ ⭠ master± ⮀ ~/mongoose-os/fw/examples/c_mqtt ⮀
    ❯ tree [11:36:39]
    .
    ├── build
    │   ├── build.log
    │   ├── fs
    │   │   ├── conf_defaults.json
    │   │   ├── DST_Root_CA_X3.pem
    │   │   ├── example.txt
    │   │   ├── index.html
    │   │   ├── readme.txt
    │   │   ├── sys_config_schema.json
    │   │   └── sys_ro_vars_schema.json
    │   ├── fw.zip
    │   ├── gen
    │   │   ├── 0x11000.ld
    │   │   ├── build_info.c
    │   │   ├── build_info.json
    │   │   ├── conf_defaults.json
    │   │   ├── ffi_exports.c
    │   │   ├── mg_build_info.c
    │   │   ├── rboot-hex2a.h
    │   │   ├── symbols_dump.txt
    │   │   ├── sys_config.c
    │   │   ├── sys_config_defaults.json
    │   │   ├── sys_config.h
    │   │   ├── sys_config_schema.json
    │   │   ├── sys_ro_vars.c
    │   │   ├── sys_ro_vars_defaults.json
    │   │   ├── sys_ro_vars.h
    │   │   └── sys_ro_vars_schema.json
    │   └── objs
    │   └── fw.elf
    ├── fs
    │   └── readme.txt
    ├── mos.yml
    ├── README.md
    ├── shot.png
    └── src
    ├── conf_schema.yaml
    └── main.c

    6 directories, 32 files
    ✔ bernardo ⮀ ⭠ master± ⮀ ~/mongoose-os/fw/examples/c_mqtt ⮀
    ❯ mos flash [11:36:46]
    Loaded c_mqtt/esp8266 version 1.0 (20170301-140258/???)
    Opening /dev/ttyUSB0...
    Connecting to ESP8266 ROM, attempt 1 of 10...
    Connected
    Running flasher @ 460800...
    Flasher is running
    Flash size: 4194304, params: 0x0240
    Deduping...
    2544 @ 0x0 -> 0
    547808 @ 0x11000 -> 0
    131072 @ 0xdb000 -> 20480
    128 @ 0x3fc000 -> 0
    Writing...
    4096 @ 0x1000
    20480 @ 0xde000
    4096 @ 0xfb000
    Wrote 28672 bytes in 0.69 seconds (323.96 KBit/sec)
    Verifying...
    2544 @ 0x0
    4096 @ 0x1000
    547808 @ 0x11000
    131072 @ 0xdb000
    4096 @ 0xfb000
    128 @ 0x3fc000
    Booting firmware...
    All done!
    ✔ bernardo ⮀ ⭠ master± ⮀ ~/mongoose-os/fw/examples/c_mqtt ⮀
    ❯ mos config-set i2c.enable=true sys.atca.enable=true debug.level=3 i2c.debug=true [11:36:54]
    Getting configuration...
    Setting new configuration...
    Saving and rebooting...
    ✔ bernardo ⮀ ⭠ master± ⮀ ~/mongoose-os/fw/examples/c_mqtt ⮀
    ❯ mos console [11:37:03]
    bcn 0
    del if1
    usl
    add if1
    dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
    bcn 100
    mgos_wifi_setup_ap WiFi AP IP: 192.168.4.1/255.255.255.0 gw 192.168.4.1, DHCP range 192.168.4.2 - 192.168.4.100
    mgos_i2c_create I2C GPIO init ok (SDA: 12, SCL: 14)
    mgos_i2c_start 12 14, addr 0x00, mode W => ab 0x00
    mgos_i2c_send_byte sent 0x00, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode R => ab 0xc1
    mgos_i2c_send_byte sent 0xc1, got NAK
    mgos_i2c_stop stopped
    mgos_i2c_start 12 14, addr 0x60, mode W => ab 0xc0
    mgos_i2c_send_byte sent 0xc0, got NAK
    mgos_i2c_stop stopped
    mgos_atca_init Failed to get info
    esp_mgos_init2 MG init error: -20
    mgos_upd_boot_finish 0 0
    esp_mgos_init Init failed: -20
    bcn 0
    del if1
    usl

    ets Jan 8 2013,rst cause:2, boot mode:(3,7)

    load 0x40100000, len 1720, room 16
    tail 8
    chksum 0xe7
    load 0x3ffe8000, len 784, room 0
    tail 0
    chksum 0xd0
    csum 0xd0� `�Y =b h�@mIhp��p�+�I�Q�Y JRAEa
    !�� � �n��r��n|� �lrl��r�l��mode : sta(18:fe:34:f9
    esp_mgos_init2 c_mqtt 1.0 (20170301-140258/???)
    esp_mgos_init2 Mongoose OS Firmware 2017030114 (20170301-140258/???)
    esp_mgos_init2 SDK 2.0.0(656edbf), RAM: 49224 total, 46100 free
    esp_print_reset_info Reset cause: 4 (soft reset)
    fs_mount Mounting FS: 131072 @ 0xdb000
    mgos_sys_config_init MAC: 1AFE34F90E39
    mgos_sys_config_init WDT: 30 seconds
    scandone
    del if0
    usl
    mode : null
    mgos_wifi_set_mode WiFi mode: AP
    mode : softAP(1a:fe:34:f9:0e:39)
    add if1
    dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
    bcn 100
    mgos_wifi_setup_ap WiFi AP: SSID Mongoose_F90E39, channel 6
    bcn 0
    del if1
    usl
    add if1
    dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
    bcn 100
    mgos_wifi_setup_ap WiFi AP IP: 192.168.4.1/255.255.255.0 gw 192.168.4.1, DHCP range 192.168.4.2 - 192.168.4.100
    mgos_i2c_create I2C GPIO init ok (SDA: 12, SCL: 14)
    mgos_i2c_start 12 14, addr 0x00, mode W => ab 0x00
    mgos_i2c_send_byte sent 0x00, got NAK
    ...

  • rojerrojer Dublin, Ireland

    well, the device does not respond to its address. try the following now - do not enable atca just yet, let's scan the I2C bus.
    reflash again, then do:

    $ mos config-set i2c.enable=true debug.level=3 i2c.debug=true
    Using port /dev/ttyUSB0
    Getting configuration...
    Setting new configuration...
    Saving and rebooting...
    $ mos call I2C.Scan
    Using port /dev/ttyUSB0
    [
      96
    ]
    
  • Sorry about the delay.
    It's launch time in Brazil.

    I guess the ESP8266 can't see the ATECC508A?

    ✔ bernardo ⮀ ⭠ master± ⮀ ~/mongoose-os/fw/examples/c_mqtt ⮀
    ❯ mos flash [12:19:40]
    Loaded c_mqtt/esp8266 version 1.0 (20170301-140258/???)
    Opening /dev/ttyUSB0...
    Connecting to ESP8266 ROM, attempt 1 of 10...
    Connected
    Running flasher @ 460800...
    Flasher is running
    Flash size: 4194304, params: 0x0240
    Deduping...
    2544 @ 0x0 -> 0
    547808 @ 0x11000 -> 0
    131072 @ 0xdb000 -> 8192
    128 @ 0x3fc000 -> 0
    Writing...
    4096 @ 0x1000
    8192 @ 0xde000
    4096 @ 0xfb000
    Wrote 16384 bytes in 0.40 seconds (321.02 KBit/sec)
    Verifying...
    2544 @ 0x0
    4096 @ 0x1000
    547808 @ 0x11000
    131072 @ 0xdb000
    4096 @ 0xfb000
    128 @ 0x3fc000
    Booting firmware...
    All done!
    ✔ bernardo ⮀ ⭠ master± ⮀ ~/mongoose-os/fw/examples/c_mqtt ⮀
    ❯ mos config-set i2c.enable=true debug.level=3 i2c.debug=true [12:19:44]
    Getting configuration...
    Setting new configuration...
    Saving and rebooting...
    ✔ bernardo ⮀ ⭠ master± ⮀ ~/mongoose-os/fw/examples/c_mqtt ⮀
    ❯ mos call I2C.Scan [12:19:52]
    []

  • rojerrojer Dublin, Ireland

    well, the chip is not responding to any address (empty scan result).
    either it's dead, or connection is loose, or... i don't know what else, really.

Sign In or Register to comment.