element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Summer of Sensors Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Summer of Sensors Design Challenge
  • More
  • Cancel
Summer of Sensors Design Challenge
Blog Blog #5: Adding Connectivity to the Project using Renesas DA16600 Wi-Fi Module
  • Blog
  • Forum
  • Documents
  • Design Challenge
  • Leaderboard
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Summer of Sensors Design Challenge to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: misaz
  • Date Created: 10 Nov 2022 10:10 PM Date Created
  • Views 3517 views
  • Likes 11 likes
  • Comments 8 comments
  • zmod4510-evk
  • ra2l1
  • zmod4510
  • DA16600
  • DA16600MOD
  • at
  • air quality
  • wi-fi
  • Summer of Sensors Design Challenge
  • da16200
  • cloud
  • renesas
  • uart
  • summer of sensors
  • e2 studio
  • In the Air Tonight
  • api
  • freertos
Related
Recommended

Blog #5: Adding Connectivity to the Project using Renesas DA16600 Wi-Fi Module

misaz
misaz
10 Nov 2022
Blog #5: Adding Connectivity to the Project using Renesas DA16600 Wi-Fi Module

Hello everyone. I welcome you to my 5th blog as part of my serie about ZMOD4510 Outdoor Air Quality sensor as part of Summer of Sensors Design Challenge and category In the Air Tonight category. In my first blog I described my plans as part of competition. In second blog I described kit which I use as part of competition. In third blog post I shown my first experiences with the sensor and first measured data. In previous, fourth, blog I implemented first part of firmware which interfaced with Renesas ZMOD4510 Outdoor Air Quality sensor and provided me a data. I write it as a very detailed tutorial. Since posting my previous blog post long time passed but I am working intensively on it. This time I will describe Wi-Fi module which I chosen for connecting to Wi-Fi and how did I connected it to the network. I spend a quite a lot of time with it (several days) because I had no experiences with this platform and it took me a lot of time until I get into it. At the time of writing this blog I have almost completed my project and started measuring real data form sensor placed outside. But this will be described in next blogs.

Renesas DA16600 Wi-Fi Module

For connectivity to the internet, I chosen Renesas DA16600 Wi-Fi + BLE Module. This module originally come from Dialog Semiconductor but since Dialog was acquired by Renesas, this module is offered by Renesas now. I chosen this module for several reasons:

  1. Contest in this category is sponsored by Renesas. So, I decided to prefer Renesas as much as possible. For this reason, in previous part, I selected Renesas RA2L1 platform and for connectivity I chosen Renesas DA16600 Wi-Fi Module.
  2. Module is also mentioned in Renesas Quick Connect, so I thought it would be easy to integrate it within e2-studio.
  3. I attended Renesas webinar about this module, so I was interested in trying it.

For testing module, I decided to order it on PMOD compatible board because RA2L1 have two PMODs. This board do not expose many pins of module but for simple connectivity it is sufficient. Board is referred as US159-DA16600EVZ.

image

DA16600 vs DA16200

There are two similar modules. First one is DA16200 and second option is DA16600. Both contains the same chip DA16200. But DA16600 adds DA14531 Bluetooth capable chip. So DA16600 is SoM containing two chips (+ some supporting chips like QSPI FLASH).

Integrating Wi-Fi Module to the project

After I received module I started integrating it to my project. I originally thought that it would be as simple as adding block in e2 studio like it was in case of ZMOD4510 because it is mentioned in Rensas Quick Connect ecosystem. But opposite is true. While it look that Renesas do some preparation works for integrating Wi-Fi modules to their ecosystem currently there are no block with this support. There several demo projects and all integrates module differently. At beginning it would be nice to mention some approaches of using module.

DA16600 Modes of Integration

Developers using module can use it in multiple ways. Generally, developers can:

  1. Download SDK with RTOS from Renesas website, develop application running directly on DA16200 and flash it to the module. Two RTOSes are available: FreeRTOS and ThreadX.
  2. Download prebuild firmware from Renesas and communicate with module using AT commands.
  3. Download prebuild firmware from Renesas containing some added application and otherwise use AT commands.

Almost all demos use second and third approach. First approach allows you to make single-chip device, but it is quite hard. SDK is quite a complex and large. Integrates many libraries and stacks.

Because I use RA2L1 microcontroller I decided to use firmware with AT commands.

Firmware

It took me very long time until I realised that I had to manually flash firmware to the device. I connected UART converter to it, but no communication occurred on UART lines. For a long time, I thought that my module is dead or bricked. But I always double checked all connections, measured voltages before connection and did not realize any mistake. Because I did not want to break my module, I spend several days with thinking about it. Later I checked schematics for searching for purpose of debugging pin headers because I noticed (using continuity mode of multimeter) that pins which I thought that are used for debugging UART communication were not connected to pins of PMOD connector. In schematics I realized that there are two UARTs. One of them is connected to PMOD and second UART is connected to debugging pin header. I also most of time ignored reset pin and later realized that my module was all the time held in reset state because initial GPIO setting of PMOD reset pin is logic low by default in Renesas FSP configuration. But even after I properly reset the module it did not respond to AT commands on PMOD interface. But with logic analyser noticed that some signals occur on debugging pin headers. Later I found that signals on the debugging UART are boot logs and are transmitted at baudrate of 230400 bauds which is not a very common default baudrate.

Downloading firmware

Firmware is available on Renesas website. It was hard to find it at first attempt because there are lot of other resources. I recommend using search field in Software Downloads section and search for “image”. On DA16600 page it will list two firmwares:

image

The first image is pure firmware with AT commands support. The second download has firmware with integrated application for connecting to AWS cloud. There is also image with integrated application for connecting to Azure. But for some reason Renesas provided it only for DA16200 module (module without additional BLE chip).

image

Flashing firmware

After downloading and extracting there is Readme and basic PDF manual showing how to flash firmware to the device. It requires using secondary UART which is exposed on debugging pin headers. After connecting with terraterm and sending enter you will enter interesting terminal with some commands. Flashing firmware is assured by terra term macro which will transmit all data in proper format. You only need to specify which type of external FLASH memory is used on the module. It looks that there are two types of external FLASH memory used (from Macronix and Atmel/Microchip) in module and tutorial gives you hint how to determine what memory is under the shield.

Provisioning

Credentials for Wi-Fi network (network name and password) can be passed to the firmware using AT commands, or you can use automatic configuration utility as part of secondary UART. Settings are then fixed in flash memory of Wi-Fi module and you do not need to configure any settings as part of your (RA2L1) MCU firmware because module will connect to preconfigured network automatically on power up.

After connecting to debugging UART with badurate 230400 (twice the 115200), you can execute “setup” command and follow wizard steps:

image

Now, module will automatically connect to configured network on boot and you do not need to connect by sending AT commands from RA2L1 MCU.

Integrating AT communication to the project

The next step is integrated communication with module using DA interface. Sending commands is easy but reception requires parsing responses, and this is not very trivial. After research I decided to use library which Renesas use in one of their examples. They use different libraries in every example project they provide, so it was not easy decision, but library which I chosen looked as the most robust. The library come from Quick-Connect IoT DA16600 Provisioning Demo Sample Code:

image

Even it looks most advanced it still do not support sending all AT commands and processing their outputs. Instead, it support very minimalistic subset of commands and I had to implement other commands which I needed.

Redesigning project

Because complexity of project grows when processing communication Wi-Fi module, I decided to redesign project first. I converted it to the FreeRTOS project and separated logic to two tasks:

  • One for handling ZMOD4510 sensor operation
  • Second thread is used for handling communication with Wi-Fi module and cloud

Editing library

Example project from Renesas implements state machine for handling connectivity events properly. This state machine was designed for targeting needs of example project and for example include states and handlers for TCP server. I do not need to use TCP server, so I had to clean the code a lot and redesign state machine and actions.

Connecting to cloud

Originally, I thought that I will use MQTT client for connecting to Azure IoT Hub and using this service forward data to further processing. Renesas firmware has AT commands for full-featured MQTT client with SSL support and support almost everything I need. I decided to add support for sending required AT commands to the library. But after I did it and polished some early bugs, I noted that it still did not work and even more it gave me ERROR reply on command specifying credentials. After further analysis I found that it is because credentials are very long and it is not possible to pass them. In case of Azure IoT HuB MQTT credentials contains whole connection string which is string containing many delimited fields and is longer than AT commands interface at DA16600 module allows. This was sad because this was barrier which limited me to complete task, and I had to redesign whole solution and throw lot of code away.

I did not give up idea about using MQTT and Azure IoT Hub at this moment. The second option was using different firmware with included application which allows connecting to Azure IoT Hub. Client will run on chip and thus can pass longer credentials than AT interface allows. But there was other issue. You maybe remember that firmware with Azure Iot Hub Client application is available only for DA16200 module and I have DA16600…. I was analysing if I can flash firmware deigned for DA16200 to DA16600. Both modules have the same Wi-Fi Chip (DA16200) so it should be possible, but later I noticed that prebuild firmware supports only modules with different external flash memories (Macronix) than my module had (Atmel/Microchip) and because I was not sure if I can safely flash this firmware to the device targeting different flash memory, I decided to do not do this.

As a replacement solution I decided to go less advanced way. Using Azure IoT Hub is generally good option, but for my experiments I did not need so advanced solution. I decided to send data to cloud using HTTPS client instead. HTTPS assure similar level of security like MQTT client do (both use SSL), but I had to implement more things from scratch (for example authentication). I had to implement HTTPS server with API which will my device later use for sending data. This was quite easy for me. I used ASP.NET Core. At device side sending is simple because there is AT command for sending data using HTTP requests (note that command support SSL naturally). Command support both GET and POST requests which is nice.

image

Command generally looks easy, but processing answer was more complicated. I had to implement lot of processing stuff manually and it took me additional time.

Sending JSON or not?

For development I was trying to send data in JSON format but very soon I faced the similar issue which I was facing with MQTT credentials setting AT command. It crashed with error because my command containing JSON payload was too long. So, I had to redesign solution again, but now it was easier. Because I send very few data, I decided to send them in binary. Because AT interface is naturally ASCII, I decided to encode data in base64 which will still result much shorter payload than JSON. After I implemented all these, I successfully transferred data to my cloud application written in ASP.NET Core and this application save them to the Azure Cosmos DB.

Summary

This is all from this blog post. In this blog I described over month-long journey of integrating Renesas Wi-Fi module to the project for sending data to the cloud. For summary I had to:

  • Learn DA16600 basics about Wi-Fi module
  • Flash firmware to the DA16600 Wi-Fi module
  • Migrate my project to FreeRTOS
  • Integrate DA16600 AT library to the project
  • Add HTTP(S) client AT command functionality to the library
  • Implement Base64 encoding
  • Develop web API for retrieving data

It was nice journey but cost me lot of time. I wrote lot of code which I later thrown away. Even more it was not very related to ZMOD4510 (and this design challenge is about ZMOD5410). But at the end I have Renesas only solution which works nice and after first hours of running looks reliable. In the next blog post I will show my DIY box which I will use for basic protection of my experimental setup outside. Thank you for reading this blog post and stay tuned to my next blog posts. If you have any questions about DA16600, ZMOD4510, my project or something else, then feel free to ask in comments below.

Next blog: Blog #6: Building Box for ZMOD4510 Outdoor Air Quality Monitor and Going Outside

  • Sign in to reply
Parents
  • dougw
    dougw over 2 years ago

    I never would have suspected anyone would use 230400 baud .... I wonder why they did. Good work sticking with it to get it working.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • beacon_dave
    beacon_dave over 2 years ago in reply to dougw

    On a side note, are you aware of any popular embedded technology from the 1980's using 5200 baud for comms? Did data loggers / instrumentation perhaps use this rate?  

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dougw
    dougw over 2 years ago in reply to beacon_dave

    That triggers a vague memory, but I don't remember anything specific that used that rate. It was always exciting when a new, faster baud rate became feasible.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • misaz
    misaz over 2 years ago in reply to beacon_dave

    1980 is approximately 20 years before I born, so I hear about baud rate 5200 for a first time. Smiley

    Old good AVR datasheets mention only "common" baudrates 2400 and 4800 (lower than 9600) so I never realized that 5200 was standard baud rate in history. Nice to know about it.

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • misaz
    misaz over 2 years ago in reply to beacon_dave

    1980 is approximately 20 years before I born, so I hear about baud rate 5200 for a first time. Smiley

    Old good AVR datasheets mention only "common" baudrates 2400 and 4800 (lower than 9600) so I never realized that 5200 was standard baud rate in history. Nice to know about it.

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • beacon_dave
    beacon_dave over 2 years ago in reply to misaz

    10400 baud was later used for automotive OBD K-Line protocol but as you can see, like 5200, it is not a commonly used baud rate for a lot of UART applications. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube