Search This Blog

Saturday, July 28, 2018

Sonar for the visually impaired - microcontroller choices

Projects / Project Swiftlet  "It's all about the Pentiums" Original post date: 06/21/2015

This section of the project is all about MCU, RTOS and firmware.
  • This project is all about power management and good battery life. Efficient coding helps a lot in reducing power.
  • Using Freescale MKL series Cortex-M0+ Based Microcontroller optimized for low power applications. VLPR (Very Low Power Run) mode computer operation at a reduced clock speed of 4MHz uses very little power (732 μA).
  • port ChibiOS to the MKL16 from the MKL25 target.
  • New in 3.0 is the Tick-less kernel mode for low power devices.
  • ChibiOS/RT and ChibiOS/NIL share most of their API, so migration to/from the light weight version (NIL) is possible. 
  • Certain libraries/frameworks that uses busy polling loops have no place here.
  • port DMA-SPI library. DMA can reduce CPU load during data transfer.
  • make use of fixed point math (vs floating point math) to reduce computational complexity requiring less cycles. Distance can easily be fit inside 16-bit integer operations. e.g. 0.0000m - 6.5535m (~5m is the upper limits of the rangefinder)

Memory Map


For a device with 16kB of RAM
SRAM_L: 0x1FFF_F000 - 0x1FFF_FFFF
SRAM_U: 0x2000_0000 - 0x2000_3000

For a device with 32kB of RAM
SRAM_L: 0x1FFF_E000 - 0x1FFF_FFFF
SRAM_U: 0x2000_0000 - 0x2000_6000

Note: SRAM contents are retained in VLLS3, but not In VLLSi, VLLS0.

Clock

External 32.768kHz crystal in Low-Frequency, Low-Power mode. as it has the lowest power consumption. The crystal load capacitance is 12.5pF. Assuming the stray capacitance of 5pF, additional CL1, CL2 of 10pF is needed. This can be programmed in the OSCx_CR register.

The external 32.768kHz is used as the clock reference for the FLL. DCO frequency is set to 640x at 20.97152MHz (low range) For my application, FLL accuracy is sufficient.

Editorial note: After I have been playing with STM32F for a while, I wonder of their STMF0 series of chips would have been a better choice?  Also free Keil license.  Their DMA isn't as advanced as Freescales however.

The ARM peripherals can be assigned to certain specific combinations of pin locations. It takes a bit of time to take advantage of this in the layout so that the peripherals are facing the right directions. and that all the needed peripherals are not block one another.
  • Power management - I/O assigned and most of them routed.
  • Pins available for an expansion connector - SPI2 + UART. e.g. a graphic LCD for test/debugging, additional sensors etc.
  • Found I2C temperature sensor/EEPROM combo (SE97B) which is intended for DDR memory market. Temperature sensing is needed for range finder correction while the EEPROM can hold some calibration/preference data.
  • I'll need to start working on the firmware side at some point using the Teensy LC for the time being. Most probably I would try to port ChibiOS RTOS to the MKL16. There is going to be a bit of bringup, low level drivers and swearing as usual.
While I could probably get by with a cooperative multitasking in a big loop, having access to messages, queues would make the code better organized.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.