Create an endless stream of prime numbers - a bit like IntStream.of(2,3,5,7,11,13,17), but infinite. The stream must be able to produce a million primes in a few seconds.
Sunday, April 8, 2018
Tuesday, October 3, 2017
ESP8266 vs ESP32
Specifications | ESP8266 | ESP32 |
---|---|---|
MCU | Xtensa Single-core 32-bit L106 | Xtensa Dual-Core 32-bit LX6 with 600 DMIPS |
802.11 b/g/n Wi-Fi | Yes, HT20 | Yes, HT40 |
WiFi Security | ? | WEP, WPA/WPA2 PSK/Enterprise |
Hardware Accelerated Encryption | ? | AES/SHA2/Elliptical Curve Cryptography/RSA-4096 |
Bluetooth | None | dual-mode: Bluetooth 4.2 BLE or classi |
Typical Frequency | 80 MHz | 240 MHz |
SRAM | 160 KB | 520 KB |
Flash | SPI Flash, up to 16 MB | SPI Flash, up to 16 MB, memory mapped to CPU code space. |
GPIO | 17 | 36 |
Hardware/Software PWM | None/8 channels | 1/16 channels |
SPI/I2S/I2C/UART | 2/1/2/2 | 3/2/2/3 |
ADC | 10 bit | 12-bit, 18 channels |
DAC | None | 2 |
CAN | None | ? |
Ethernet MAC Interface | None | 1 |
Touch Sensor | None | Yes |
Temperature Sensor | None | yes |
Working Temperature | -40 C - 125 C | -40 C - 125 C |
Operating Voltage | ? | 2.3V to 3.6V C |
Power Consumption | 77 μA | 5 μA power consumption in Deep-sleep |
Reference: http://espressif.com/en/products/hardware/esp32/overview
Friday, September 29, 2017
ZigBee for IoT
The ZigBee and Z-Wave short-range wireless technologies are used for remote monitoring and control. However, their specifications and applications are different. Both technologies are ideal for home-area networks (HANs), which is becoming an in.
Differences between ZigBee and Z-Wave:
Technology | Frequency | Modulation | Data Rate | Range | Applications |
---|---|---|---|---|---|
ZigBee | 902 to 928 MHz (Americas and Australia)2.4 - 2.483 GHz (ISM) | BPSK (900 MHz band) or OQPSK (2.4 GHz band) | 250 kbps | 10 m | Home Automation, Smart Grid, Remote control |
Z-Wave | 908.42 MHz | GFSK | 9.6/40 kbps | 30 m | Home Automation, security |
ZigBee
It is ratified in the IEEE’s 802.15.4 personal-area network (PAN) radio standard. ZigBee is an open wireless standard from the ZigBee Alliance. The IEEE 802.15.4 standard provides layer 1 (physical layer, or PHY) and layer 2 (media access controller, or MAC) of the network, while the ZigBee stack software provides the network and application layers.Zigbee protocol features include:
- Support for multiple network topologies such as point-to-point,
- point-to-multipoint and mesh networks
- Low duty cycle – provides long battery life
- Low latency
- Direct Sequence Spread Spectrum (DSSS)
- Up to 65,000 nodes per network
- 128-bit AES encryption for secure data connections
- Collision avoidance, retries, and acknowledgments (CSMA/CA)
ZigBee Physical Layer
ZigBee PHY operates in various bands, but the most common one is in the 2.4 GHz band. It uses offset quadrature phase-shift keying (OQPSK) that transmits two bits per symbol. In 900 MHz band, it uses BPSK for modulation. The radio uses DSSS for digital streaming.
There are three (3) kind of devices in ZigBee:
- ZigBee Coordinator (ZR)
- ZigBee Router (ZR)
- ZigBee End Device (ZED)
Tuesday, September 26, 2017
Hot skills in Embedded and IoT
Based on my observation in the job market, the following skills are currently in demand in embedded systems surrounding IoT development:
- 802.11 (WiFi)
- Bluetooth, especially Bluetooth 4.0 + Low Energy (BLE) or newer
- Zigbee (IEEE 802.15.4)
- Z-Wave: Based on ITU G.9959 (PHY) and Z-Wave Application layer
- Bonjour (mDNS/DNS-SD)
- SSDP (Simple Service Discovery Protocol)
- OCF (Open Connectivity Foundation's uPnP Device Control Protocol)
- TCP/UDP
- TLS (Transport Layer Security)
- CoAP (Constrained Application Protocol; RFC-7252)
- HTTP, especially RESt API
- MQTT (Mosquitto)
- MultiThread
- Websockets
- RESTful (Representational State Transfer) architecture
- Rust (Rust is a programming language that’s focused on safety, speed, and concurrency)
- Jenkins
- XML
- LWM2M
- SQS
- AMQP
- Kafka
- AWS (Amazon Web Service)
- Microsoft Azure
- I2C
- SPI
- Asynchronous serial/UART programming
- Linux Kernel and Driver development
Thursday, September 21, 2017
Pointer to certain address in memory
In embedded system where we are working with microcontroller, many times we find a scenario where we need to access a memory-mapped register in the MCU. How do we do that in generic way (for example with GCC compiler)?
The answer is to write it like below:
volatile <type> *<varname> = (<type> *)<address>
For example:
#include <stdio.h>
volatile char *var = (char *)0x1000;
int main()
{
if (*var != 0)
puts("NOT NULL!");
}
rendered into x86 assembly (64-bit Intel CPU) as:
...
...
.LC0:
.string "NOT NULL!"
main:
movq var(%rip), %rax # rax = address of var
movzbl (%rax), %eax # eax = *var
testb %al, %al
jne .L9
xorl %eax, %eax
ret
.L9:
pushq %rax
movl $.LC0, %edi
call puts
xorl %eax, %eax
popq %rdx
ret
...
.LCOLDE1:
.section .text.startup
.LHOTE1:
.globl var
.data
.align 8
.type var, @object
.size var, 8
var:
.quad 4096 # or 0x1000
The answer is to write it like below:
volatile <type> *<varname> = (<type> *)<address>
For example:
#include <stdio.h>
volatile char *var = (char *)0x1000;
int main()
{
if (*var != 0)
puts("NOT NULL!");
}
rendered into x86 assembly (64-bit Intel CPU) as:
...
...
.LC0:
.string "NOT NULL!"
main:
movq var(%rip), %rax # rax = address of var
movzbl (%rax), %eax # eax = *var
testb %al, %al
jne .L9
xorl %eax, %eax
ret
.L9:
pushq %rax
movl $.LC0, %edi
call puts
xorl %eax, %eax
popq %rdx
ret
...
.LCOLDE1:
.section .text.startup
.LHOTE1:
.globl var
.data
.align 8
.type var, @object
.size var, 8
var:
.quad 4096 # or 0x1000
Subscribe to:
Posts (Atom)