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
Sensors Projects
  • Challenges & Projects
  • Project14
  • Sensors Projects
  • More
  • Cancel
Sensors Projects
Blog Wio Terminal Sensor Fusion - Project Wrap Up
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Sensors Projects to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: ralphjy
  • Date Created: 17 Nov 2020 6:11 AM Date Created
  • Views 938 views
  • Likes 3 likes
  • Comments 0 comments
  • sensorsch
  • tinyml
  • edge impulse
  • wio terminal
Related
Recommended

Wio Terminal Sensor Fusion - Project Wrap Up

ralphjy
ralphjy
17 Nov 2020

I haven't gotten the Keyword Spotting working yet, but since today is the deadline I thought I should summarize how far I've gotten.

 

ADC Timing

The impulse that I'm trying to use was sampled at 16KHz with 1 second windows.

The equation for sampling rate is:

RS = fCLK_ADC / ( nSAMPLING + nOFFCOMP + nDATA)

where fCLK_ADC = processor clock/prescaler  --> processor clock is 48MHz

nSAMPLING is the number of clocks in the sampling period

nOFFCOMP is a fixed 4 clock sampling period (use either nOFFCOMP or nSAMPLING but not both)

nDATA is the number of bits (resolution)

 

So, with a prescaler value of 128 and a total of 23 clocks per sample would be about a 16.3 KHz sampling rate

 

I went to verify this on the scope.  I'm setting the DMA to transfer 16000 samples per buffer and toggle the signal between buffers.  For a 16 KHz sampling rate I should see a period of 2 seconds.

With 23 clocks per sample (nSAMPLING = 11 and nDATA = 12) I ended up with 2.04 seconds or about 15.7 KHz.

With 22 clocks per sample (nSAMPLING = 10 and nDATA = 12) I ended up with 1.96 seconds or about 16.3 KHz.

 

Not sure how much effect this will have but I'll try the higher sample rate.

The registers are set as follows:

ADC1->CTRLA.reg = ADC_CTRLA_PRESCALER_DIV128

ADC1->SAMPCTRL.bit.SAMPLEN = 0x0a

ADC1->CTRLB.reg = ADC_CTRLB_RESSEL_12BIT

 

Here is the scope capture:

image

 

The impulse partitions the 1 second sampling window into 4 slices, so my DMA buffers will hold 4000 samples each.

 

Error compiling with the impulse (model library)

Unfortunately there is a known problem with filename length using the Arduino IDE on Windows (32k character limit) that I had forgotten about, so I had problems compiling.

image

I had run into this problem when compiling the Nano 33 BLE Sense example and had to add a patch to the arduino hardware mbed library.

Luckily, Edge Impulse has a patch http://cdn.edgeimpulse.com/drivers/samd51-arduino/platform.local.txt for the samd51 that I added to the seeeduino hardware samd library.  The patch indicated that it is for an Adafruit samd51 but it seems to work for me.

 

Sample buffer overrun

image

This is where I am currently.  I think that I made some coding errors integrating the impulse library.  Hopefully I can find the errors by inspection, otherwise I'll need to think about how to debug the program.  Might be a problem understanding how the data is being handled.  Or maybe I made a mistake with the DMA.

 

I need to take some time off for other projects but I'll post when I get this figured out.

 

 

 

Links to related posts

Wio Terminal Sensor Fusion - Introduction

Wio Terminal Sensor Fusion - Sensor Integration

Wio Terminal Sensor Fusion - Remote Data Display and Control using Blynk

Wio Terminal Sensor Fusion - Remote Data Display and Control using Blynk continued

Wio Terminal Sensor Fusion - TinyML Keyword Spotting Part 1

Wio Terminal Sensor Fusion - TinyML Keyword Spotting Part 2

  • Sign in to reply
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