How is the btmgmt command used to set PHY? - bluetooth-lowenergy

When I run the command: btmgmt phy LE2MTX LE2MRX
It returns:
Could not set PHY Configuration with status 0x0d (Invalid Parameters)
btmon shows:
# MGMT Open: btmgmt
# MGMT Command: Set PHY Configuration (0x0045) plen 4
Selected PHYs: 0x1800
LE 2M TX
LE 2M RX
# MGMT Event: Command Status (0x0002) plen 3
Set PHY Configuration (0x0045)
Status: Invalid Parameters (0x0d)
# MGMT Close: btmgmt
I'm very unfamiliar with btmgmt, how do I specify that I want LE 2M PHY whenever possible?
If I run: btmgmt phy
I get the available PHYs which incudes the LE2MTX and LE2MRX (which I am after).
Supported phys: BR1M1SLOT BR1M3SLOT BR1M5SLOT EDR2M1SLOT EDR2M3SLOT EDR2M5SLOT EDR3M1SLOT EDR3M3SLOT EDR3M5SLOT LE1MTX LE1MRX LE2MTX LE2MRX
Configurable phys: BR1M3SLOT BR1M5SLOT EDR2M1SLOT EDR2M3SLOT EDR2M5SLOT EDR3M1SLOT EDR3M3SLOT EDR3M5SLOT LE2MTX LE2MRX
Selected phys: BR1M1SLOT BR1M3SLOT BR1M5SLOT EDR2M1SLOT EDR2M3SLOT EDR2M5SLOT EDR3M1SLOT EDR3M3SLOT EDR3M5SLOT LE2MTX LE2MRX
These can also be seen in btmon:
Get PHY Configuration (0x0044) plen 12
Status: Success (0x00)
Supported PHYs: 0x1fff
BR 1M 1SLOT
BR 1M 3SLOT
BR 1M 5SLOT
EDR 2M 1SLOT
EDR 2M 3SLOT
EDR 2M 5SLOT
EDR 3M 1SLOT
EDR 3M 3SLOT
EDR 3M 5SLOT
LE 1M TX
LE 1M RX
LE 2M TX
LE 2M RX
Configurable PHYs: 0x19fe
BR 1M 3SLOT
BR 1M 5SLOT
EDR 2M 1SLOT
EDR 2M 3SLOT
EDR 2M 5SLOT
EDR 3M 1SLOT
EDR 3M 3SLOT
EDR 3M 5SLOT
LE 2M TX
LE 2M RX
Selected PHYs: 0x19ff
BR 1M 1SLOT
BR 1M 3SLOT
BR 1M 5SLOT
EDR 2M 1SLOT
EDR 2M 3SLOT
EDR 2M 5SLOT
EDR 3M 1SLOT
EDR 3M 3SLOT
EDR 3M 5SLOT
LE 2M TX
LE 2M RX

Related

QEMU doesn't support the virtualization of two CPUs

My computer host machine has two phyiscal CPUs.The mode of mother board is WS C621E SAGE Manual.
root#ubuntu:~# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 46 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 32
On-line CPU(s) list: 0-31
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) Silver 4208 CPU # 2.10GHz
CPU family: 6
Model: 85
Thread(s) per core: 2
Core(s) per socket: 8
Socket(s): 2
Stepping: 7
CPU max MHz: 3200.0000
CPU min MHz: 800.0000
BogoMIPS: 4200.00
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology no
nstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnow
prefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm mpx rdt_
a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp
_epp hwp_pkg_req pku ospke avx512_vnni md_clear flush_l1d arch_capabilities
Virtualization features:
Virtualization: VT-x
Caches (sum of all):
L1d: 512 KiB (16 instances)
L1i: 512 KiB (16 instances)
L2: 16 MiB (16 instances)
L3: 22 MiB (2 instances)
NUMA:
NUMA node(s): 2
NUMA node0 CPU(s): 0-7,16-23
NUMA node1 CPU(s): 8-15,24-31
Vulnerabilities:
Itlb multihit: KVM: Mitigation: VMX disabled
L1tf: Not affected
Mds: Not affected
Meltdown: Not affected
Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Retbleed: Mitigation; Enhanced IBRS
Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Srbds: Not affected
Tsx async abort: Mitigation; TSX disabled
When I use command:
root#ubuntu:~# egrep -c '(vmx|svm)' /proc/cpuinfo
64
but when I usec command:
root#ubuntu:~# virsh nodecpumap
CPUs present: 32
CPUs online: 32
CPU map: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
So that means the QEMU hypervisor dosent supppor two phyiscal CPUs? How do I solve it ?
Openstack, KVM ,QEMU ,Libvirt
The lshw command has detected
2 sockets (physical CPUs)
8 cores per socket
2 threads per core
So the expected number of vcpus is 2 · 8 · 2 = 32.
If still in doubt, even the intel reference for Xeon(R) Silver 4208 CPU states that you have 16 threads per CPU.

RaspberryPi 4 - ADS1256 - The reading in registers don't work well

I have a project that includes a RaspberryPi 4 and an ADS1256 ADC converter.
It managed to implement as read and write functions of the registers, which are working almost in their entirety, on reading and writing, but reading only once, not repeating for the same register.
The problem is:
When it is tried to read in the second time, the data returned is zero (0x00), including the bits that have no writing enabled.
Do you have any idea what could be some?
Conections:
| Pi 4|Module ADS1256|
+-----+----------------------+
| 4 | 1 | 5v
| 6 | 2 | gnd
| 11 | 6 | DRDY
| 12 | 7 | CS - Chip Select
| 13 | 8 | PDWN - Power Down
| 19 | 4 | DIN - Data In (Slave)
| 21 | 5 | DOUT - Data Out (Slave)
| 23 | 3 | SCLK
Attachment:
Schematic of Module ADS1256.
Main Code:
import ClassADS1256_Question, time
ads = ClassADS1256_Question.ADS1256()
# ----- Configuração Inicial ----
read = 1
while True:
time.sleep(2)
print('----- Read {} ------'.format(read))
# Registers Adress - Name - default value - Result
print('00h STATUS 3xh ', ads.ReadReg(ads.REG_STATUS))
print('01h MUX 01h ', ads.ReadReg(ads.REG_MUX))
print('02h ADCON 20h ', ads.ReadReg(ads.REG_ADCON))
print('03h DRATE F0h ', ads.ReadReg(ads.REG_DRATE))
print('04h IO E0h ', ads.ReadReg(ads.REG_IO))
print('05h OFC0 xxh ', ads.ReadReg(ads.REG_OFC0))
print('06h OFC1 xxh ', ads.ReadReg(ads.REG_OFC1))
print('07h OFC2 xxh ', ads.ReadReg(ads.REG_OFC2))
print('08h FSC0 xxh ', ads.ReadReg(ads.REG_FSC0))
print('09h FSC1 xxh ', ads.ReadReg(ads.REG_FSC1))
print('0Ah FSC2 xxh ', ads.ReadReg(ads.REG_FSC2))
read += 1
Result:
[----- Read 1 ------
#Register Address- Register's Name- Default Value - Result
00h STATUS 3xh 0x30
01h MUX 01h 0x1
02h ADCON 20h 0x20
03h DRATE F0h 0xf0
04h IO E0h 0xff
05h OFC0 xxh 0x67
06h OFC1 xxh 0x1
07h OFC2 xxh 0x0
08h FSC0 xxh 0x9f
09h FSC1 xxh 0x0
0Ah FSC2 xxh 0x45
----- Read 2 ------
00h STATUS 3xh 0x0
01h MUX 01h 0x0
02h ADCON 20h 0x0
03h DRATE F0h 0x0
04h IO E0h 0x0
05h OFC0 xxh 0x0
06h OFC1 xxh 0x0
07h OFC2 xxh 0x0
08h FSC0 xxh 0x0
09h FSC1 xxh 0x0
0Ah FSC2 xxh 0x0
----- Read 3 ------
00h STATUS 3xh 0x0
01h MUX 01h 0x0
02h ADCON 20h 0x0
03h DRATE F0h 0x0
04h IO E0h 0x0
05h OFC0 xxh 0x0
06h OFC1 xxh 0x0
07h OFC2 xxh 0x0
08h FSC0 xxh 0x0
09h FSC1 xxh 0x0
0Ah FSC2 xxh 0x0
----- Read 4 ------
00h STATUS 3xh 0x0
01h MUX 01h 0x0
02h ADCON 20h 0x0
03h DRATE F0h 0x0
04h IO E0h 0x0
05h OFC0 xxh 0x0
06h OFC1 xxh 0x0
07h OFC2 xxh 0x0
08h FSC0 xxh 0x0
09h FSC1 xxh 0x0
0Ah FSC2 xxh 0x0
----- Read 5 ------
00h STATUS 3xh 0x0
01h MUX 01h 0x0
02h ADCON 20h 0x0
03h DRATE F0h 0x0
04h IO E0h 0x0
05h OFC0 xxh 0x0
06h OFC1 xxh 0x0
07h OFC2 xxh 0x0
08h FSC0 xxh 0x0
09h FSC1 xxh 0x0
0Ah FSC2 xxh 0x0
Class (arquivo ClassADS1256_Question)
#Imports -----------------------------------------------------
import wiringpi as wp
#Class -------------------------------------------------------
class ADS1256:
#Constantes da Classe -----------------------------------------
#Constantes de Configuração
SPI_MODE = 1 #There are nothing about this on datasheet but is 1 # nas internet diz que ele é modo 1, mas no datasheet não fala
SPI_CHANNEL = 1 # I don't know why #não sei o que significa
SPI_FREQUENCY = 1000000 # The ADS1256 supports 768kHz to 1.92MHz
DRDY_TIMEOUT = 0.5 # Seconds to wait for DRDY when communicating
DATA_TIMEOUT = 0.00001 # 10uS delay for sending data
SCLK_FREQUENCY = 7680000 # default clock rate is 7.68MHz
#PINOUT #Constantes de Conexão Elétrica
CS_PIN = 12 #29 # mudei pra 29 e testei que é esse mesmo!!!
DRDY_PIN = 11
RESET_PIN = 29 # There are not acess to this port on module # Esse pino não tem no módulo
PDWN_PIN = 13
#Register Adress #Endereço dos Registradores
REG_STATUS = 0x00
REG_MUX = 0x01
REG_ADCON = 0x02
REG_DRATE = 0x03
REG_IO = 0x04
REG_OFC0 = 0x05
REG_OFC1 = 0x06
REG_OFC2 = 0x07
REG_FSC0 = 0x08
REG_FSC1 = 0x09
REG_FSC2 = 0x0A
# Data Rate #Taxa de Amostragem
DRATE_30000 = 0b11110000 # 30,000SPS (default)
DRATE_15000 = 0b11100000 # 15,000SPS
DRATE_7500 = 0b11010000 # 7,500SPS
DRATE_3750 = 0b11000000 # 3,750SPS
DRATE_2000 = 0b10110000 # 2,000SPS
DRATE_1000 = 0b10100001 # 1,000SPS
DRATE_500 = 0b10010010 # 500SPS
DRATE_100 = 0b10000010 # 100SPS
DRATE_60 = 0b01110010 # 60SPS
DRATE_50 = 0b01100011 # 50SPS
DRATE_30 = 0b01010011 # 30SPS
DRATE_25 = 0b01000011 # 25SPS
DRATE_15 = 0b00110011 # 15SPS
DRATE_10 = 0b00100011 # 10SPS
DRATE_5 = 0b00010011 # 5SPS
DRATE_2_5 = 0b00000011 # 2.5SPS
# Comandos
CMD_WAKEUP = 0x00 # Completes SYNC and exits standby mode
CMD_RDATA = 0x01 # Read data
CMD_RDATAC = 0x03 # Start read data continuously
CMD_SDATAC = 0x0F # Stop read data continuously
CMD_RREG = 0x10 # Read from register
CMD_WREG = 0x50 # Write to register
CMD_SELFCAL = 0xF0 # Offset and gain self-calibration
CMD_SELFOCAL= 0xF1 # Offset self-calibration
CMD_SELFGCAL= 0xF2 # Gain self-calibration
CMD_SYSOCAL = 0xF3 # System offset calibration
CMD_SYSGCAL = 0xF4 # System gain calibration
CMD_SYNC = 0xFC # Synchronize the A/D conversion
CMD_STANDBY = 0xFD # Begin standby mode
CMD_RESET = 0xFE # Reset to power-on values
#Status
STATUS_BUFFER_ENABLE = 0x02
STATUS_AUTOCAL_ENABLE = 0x04
STATUS_ORDER_LSB = 0x08
#Gain
AD_GAIN_1 = 0x00
AD_GAIN_2 = 0x01
AD_GAIN_4 = 0x02
AD_GAIN_8 = 0x03
AD_GAIN_16 = 0x04
AD_GAIN_32 = 0x05
AD_GAIN_64 = 0x06
# Clock divider
AD_CLK_EQUAL = 0x20
AD_CLK_HALF = 0x40
AD_CLK_FOURTH = 0x60
#Funções da Classe ------------------------------------------------------
# Função Iniciar
def __init__(self): # Note: A função __init__() é chamada automaticamente toda vez que a Classe está sendo usada para criar um novo objeto.
wp.wiringPiSetupPhys() # Set up the wiringpi object to use physical pin numbers
wp.pinMode(self.DRDY_PIN, wp.INPUT)# Initialize the DRDY pin
wp.pinMode(self.RESET_PIN, wp.OUTPUT)# Initialize the reset pin
wp.digitalWrite(self.RESET_PIN, wp.HIGH)
wp.pinMode(self.PDWN_PIN, wp.OUTPUT)# Initialize PDWN pin
wp.digitalWrite(self.PDWN_PIN, wp.HIGH)
wp.pinMode(self.CS_PIN, wp.OUTPUT)# Initialize CS pin
wp.digitalWrite(self.CS_PIN, wp.HIGH)
wp.wiringPiSPISetupMode(self.SPI_CHANNEL, self.SPI_FREQUENCY,self.SPI_MODE) # Initialize the wiringpi SPI setup
def WaitDRDY(self):
drdy_level = wp.digitalRead(self.DRDY_PIN)
while (drdy_level == wp.HIGH):
drdy_level = wp.digitalRead(self.DRDY_PIN)
def ReadReg(self, registrador): #Figure 34, Page 33 of ADS1256 Datasheet Version SBAS288K − JUNE 2003 − REVISED SEPTEMBER 2013
wp.digitalWrite(self.CS_PIN, wp.LOW) #Select Slave to SPI comunication #liga o chip select
wp.wiringPiSPIDataRW(self.SPI_CHANNEL, bytes([self.CMD_RREG | registrador]))#1st Command Byte: Comand Read plus Register to read
wp.wiringPiSPIDataRW(self.SPI_CHANNEL, bytes([0x00]))#2nd Command Byte #Total register to read more that one
wp.delayMicroseconds(60) #t6
lido = wp.wiringPiSPIDataRW(self.SPI_CHANNEL, bytes(0x01))
wp.digitalWrite(self.CS_PIN, wp.HIGH)
lido = hex(lido[1][0])
return lido
#return hex(ord(lido[1]))
def ReadAllReg(self):
#self.WaitDRDY()
wp.digitalWrite(self.CS_PIN, wp.LOW) #liga o chip select
wp.wiringPiSPIDataRW(self.SPI_CHANNEL, bytes([self.CMD_RREG]))#manda o comando ler e o registrador a ser lido
wp.wiringPiSPIDataRW(self.SPI_CHANNEL, bytes([0x0A]))#quantos resgistradores a mais quer ser lido. Vai seguir a sequencia da tabela de registradores
#self.DataDelay()
wp.delayMicroseconds(60)
lido = wp.wiringPiSPIDataRW(self.SPI_CHANNEL, bytes(0x0B))
wp.digitalWrite(self.CS_PIN, wp.HIGH)
print(lido)
def WriteReg(self, registrador, dado):
wp.digitalWrite(self.CS_PIN, wp.LOW)
wp.wiringPiSPIDataRW(self.SPI_CHANNEL, bytes([self.CMD_WREG | registrador]))
wp.wiringPiSPIDataRW(self.SPI_CHANNEL, bytes([0x00]))
wp.wiringPiSPIDataRW(self.SPI_CHANNEL, bytes([dado]))
wp.digitalWrite(self.CS_PIN, wp.HIGH)
wp.delayMicroseconds(10)# t11 minimo 4*Tclkin, 4*1/7680000 = 0.5 uS
def Reset(self):
wp.digitalWrite(self.CS_PIN, wp.LOW)
wp.wiringPiSPIDataRW(self.SPI_CHANNEL, bytes([self.CMD_RESET]))
wp.digitalWrite(self.CS_PIN, wp.HIGH)
wp.delayMicroseconds(8)
def ReadCanal(self):
result = []
self.WaitDRDY()
#self.WaitDRDY() # Espera o aviso de que pode ler
wp.digitalWrite(self.CS_PIN, wp.LOW) #chip select iniciando a comunicação
wp.wiringPiSPIDataRW(self.SPI_CHANNEL, bytes([self.CMD_RDATA])) # Enviando o comando Ler Dado
wp.delayMicroseconds(50) # delay t6
result.append(wp.wiringPiSPIDataRW(self.SPI_CHANNEL, bytes(0x01))[1][0]) #Lendo o primeiro Bit do dado
result.append(wp.wiringPiSPIDataRW(self.SPI_CHANNEL, bytes(0x01))[1][0]) #Lendo o segundo Bit do dado
result.append(wp.wiringPiSPIDataRW(self.SPI_CHANNEL, bytes(0x01))[1][0]) #Lendo o terceiro Bit do dado
wp.digitalWrite(self.CS_PIN, wp.HIGH) # Chip Select Desativando a comunicação
total = result[0] * 65536 # 2 ^ 16, equivalente a deslocar 16 casas decimais
total += result[1] * 256 # 2 ^ 8, equivalente a deslocar 8 casas decimais
total += result[2]
'''
print(hex(result[0]))
print(hex(result[1]))
print(hex(result[2]))
print(hex(total))
'''
return total
def SetInputMux(self,possel,negsel): #corrigir
print("Mux P {} N {}".format(possel,negsel))
wp.digitalWrite(self.CS_PIN, wp.LOW) #chip select ativado
wp.wiringPiSPIDataRW(self.SPI_CHANNEL, bytes([self.CMD_WREG | self.REG_MUX]))
wp.wiringPiSPIDataRW(self.SPI_CHANNEL, [0x00])
wp.wiringPiSPIDataRW(self.SPI_CHANNEL, [(possel<<4) | (negsel<<0)] )#corrigir aqui
wp.digitalWrite(self.CS_PIN, wp.HIGH) #chip select desativado

R with OpenBLAS

I have the code in R that works
well using the OpenBLAS, on a more modest computer with the following configurations:
[pedro#pedro-avell ~]$ lscpu
Arquitetura: x86_64
Modo(s) operacional da CPU: 32-bit, 64-bit
Ordem dos bytes: Little Endian
Tamanhos de endereço: 39 bits physical, 48 bits virtual
CPU(s): 8
Lista de CPU(s) on-line: 0-7
Thread(s) per núcleo: 2
Núcleo(s) por soquete: 4
Soquete(s): 1
Nó(s) de NUMA: 1
ID de fornecedor: GenuineIntel
Família da CPU: 6
Modelo: 60
Nome do modelo: Intel(R) Core(TM) i7-4710MQ CPU # 2.50GHz
Step: 3
CPU MHz: 3435.870
CPU MHz máx.: 3500,0000
CPU MHz mín.: 800,0000
BogoMIPS: 4989.80
Virtualização: VT-x
cache de L1d: 32K
cache de L1i: 32K
cache de L2: 256K
cache de L3: 6144K
CPU(s) de nó0 NUMA: 0-7
Opções: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts flush_l1d
In the test with a computer with configurations above, I observed by benchmark a 60% improvement in code performance time when considering parallelization. For that, I had to consider export OPENBLAS_NUM_THREADS=1. Therefore,
parallel::mclapply(1:8, FUN = function(x) func_metodos(), mc.cores = 4)), wherein func_metodos() is a function that I implemented in R and want to repeat 8 times.
However, when considering the same simulation on the computer with configurations below, I do not know how to tell the operating system to take into account the existence of 2 sockets, each with 10 cores and 2 threads per core. Should I consider export OPENBLAS_NUM_THREADS = 1 or export OPENBLAS_NUM_THREADS = 2? I considered both and ran the code in R:
parallel::mclapply(1:8, FUN = function(x) func_metodos(), mc.cores = 40))
[marcelo#ursal ~]$ lscpu
Arquitetura: x86_64
Modo(s) operacional da CPU: 32-bit, 64-bit
Ordem dos bytes: Little Endian
Tamanhos de endereço: 46 bits physical, 48 bits virtual
CPU(s): 40
Lista de CPU(s) on-line: 0-39
Thread(s) per núcleo: 2
Núcleo(s) por soquete: 10
Soquete(s): 2
Nó(s) de NUMA: 2
ID de fornecedor: GenuineIntel
Família da CPU: 6
Modelo: 85
Nome do modelo: Intel(R) Xeon(R) Silver 4114 CPU # 2.20GHz
Step: 4
CPU MHz: 800.021
CPU MHz máx.: 3000,0000
CPU MHz mín.: 800,0000
BogoMIPS: 4401.33
Virtualização: VT-x
cache de L1d: 32K
cache de L1i: 32K
cache de L2: 1024K
cache de L3: 14080K
CPU(s) de nó0 NUMA: 0-9,20-29
CPU(s) de nó1 NUMA: 10-19,30-39
Note: When I consider export OPENBLAS_NUM_THREADS = 1 or export OPENBLAS_NUM_THREADS = 2, it appears that the threads are distributed to only 20 of the 40 available cores.
Thanks for any suggestions to solve this issue so that I can use the 40 available cores.

Xbee Node Discovery Response

I'm trying to discover devices, from a coordinator, in my network.
So I sent an ND command to the coordinator and I'm correctly receiving response from other Xbee.
The next step will be to store the information I've received in a web application, in oder to send commands and data.
However, what I'm still missing is some parts in the frame respose. So far I've mapped the frame like this:
1 7E start frame
===== =================== MESSAGE LENGHT
2-3 0x00 0x19 -> 25
===== =================== PACKET TYPE
4 88 -> response to a remote AT command
5 02 frame ID
===== =================== AT COMMAND
6-7 0x4E 0x44 "ND"
8 00 status byte (00 -> OK)
===== =================== MY - Remote Address
9-10 0x17 0x85
===== =================== SH - SERIAL NUMBER HIGH
11-14 0x00 0x13 0xA2 0x00
===== =================== SL - SERIAL NUMBER LOW
15-18 0x40 0xB4 0x50 0x23
===== =================== SIGNAL
19 20
= ======== NI - Node Identifier
20 00
21 FF
22 FE
23 01
24 00
25 C1
26 05
27 10
28 1E
===== ===== CHECKSUM (25th bytes from MESSAGE LENGHT)
29 19
So, where I can find in this response the address of the device ?
My guess is in the NI part of the message but, I haven't find any example/information of how the data are organised.
Could someone point me in the right direction?
As someone told me in the dig.com forum
NI<CR> (Variable length)
PARENT_NETWORK ADDRESS (2 Bytes)<CR>
DEVICE_TYPE (1 Byte: 0=Coord, 1=Router, 2=End Device)
STATUS (1 Byte: Reserved)
PROFILE_ID (2 Bytes)
MANUFACTURER_ID (2 Bytes
So, loking to my frame response:
00 --- Node Identifier variable, (here 1 byte = 00 because no value is set up).
FFFE --- parent network address (2 bytes)
01 --- device type
00 --- status
C105 --- profile id
101E --- manufacturing id
This, afaik, means that in this last part of the frame, no information about address of the device are given. Only information are the SL and SH.
The 16-bit network address is what you've labeled "MY" (0x1785), and the 64-bit MAC address is the combination of SH/SL (00 13 A2 00 40 B4 50 23).

FFMPEG - Converting any kind of file to Mp4 compatible with IOS and Flash

I am struggling with FFmpeg within Drupal Video Module to produce files to MP4 that is compatible with IOS and Flash Player10 and up.
I have used the following commands so far, please note that the variables starting with "!" are placeholders and will be replaces with the proper items:
FFmpeg -strict experimental -y -i !videofile -pass 1 -s !widthx!height -b:v 500k -threads 0 -vcodec libx264 -vf "pad=!paddingwidth:!paddingheight:!paddingleft:!paddingtop:000000" -preset slow -an !convertfile
FFmpeg -strict experimental -y -i !videofile -pass 2 -s !widthx!height -b:v 500k -threads 0 -vcodec libx264 -vf "pad=!paddingwidth:!paddingheight:!paddingleft:!paddingtop:000000" -preset slow -acodec aac -ab 128k !convertfile
The above command produce an error as:
error executing command for rendering preset HTML5 MP4, command #1:
nice -n 19 /usr/bin/ffmpeg/ffmpeg -y -i '80137db8c3_1334836277_int_tr_19.mp4' -s 176x100 -b:v 500k -threads 0 -vcodec libx264 -preset slow -acodec aac -ab 128k '/converted/80137db8c3_1334836277_int_tr_19.mp4' 2>&1
Output:
ffmpeg version git-2013-02-01-5a67e30 Copyright (c) 2000-2013 the FFmpeg developers
built on Feb 1 2013 14:23:14 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --enable-gpl --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3
libavutil 52. 17.100 / 52. 17.100
libavcodec 54. 91.100 / 54. 91.100
libavformat 54. 61.104 / 54. 61.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 35.100 / 3. 35.100
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '80137db8c3_1334836277_int_tr_19.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2011-03-28 00:12:26
Duration: 00:02:01.14, start: 0.000000, bitrate: 703 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 601 kb/s, 29.96 fps, 29.92 tbr, 1k tbn, 59.83 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s
Metadata:
creation_time : 2011-03-28 00:12:27
handler_name : (C) 2007 Google Inc. v08.13.2007.
[libx264 # 0x34ec060] using SAR=100/99
[libx264 # 0x34ec060] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 # 0x34ec060] profile High, level 2.0
[libx264 # 0x34ec060] 264 - core 129 r2245 bc13772 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=umh subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=abr mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
The encoder 'aac' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it.
Alternatively use the non experimental encoder 'libfaac'.
Another command that I used is:
FFmpeg -i !videofile -an -pass 1 -vcodec libx264 -preset slow -b 500k -threads auto !convertfile
FFMpeg -y -i !videofile -acodec libfaac -ab 128k -pass 2 -vcodec libx264 -preset slow -b 500k -threads auto !convertfile
Output for the first pass:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'comiccon.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: mp41
creation_time : 2012-08-15 17:12:37
Duration: 01:17:15.93, start: 0.000000, bitrate: 706 kb/s
Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 636 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc
Metadata:
creation_time : 2012-08-15 17:12:37
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 63 kb/s
Metadata:
creation_time : 2012-08-15 17:12:37
handler_name : SoundHandler
Please use -b:a or -b:v, -b is ambiguous
using SAR=1/1
[libx264 # 0x1c39be0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 # 0x1c39be0] profile Main, level 3.0
[libx264 # 0x1c39be0] 264 - core 129 r2245 bc13772 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=abr mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'comiccon.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: mp41
encoder : Lavf54.61.104
Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, pass 1, 500 kb/s, 15360 tbn, 30 tbc
Metadata:
creation_time : 2012-08-15 17:12:37
handler_name : VideoHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> libx264)
Press [q] to stop, [?] for help
frame=139078 fps=279 q=32766.0 Lsize= 286145kB time=01:17:15.86 bitrate= 505.6kbits/s
video:284758kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.487000%
[libx264 # 0x1c39be0] frame I:656 Avg QP:19.51 size: 21457
[libx264 # 0x1c39be0] frame P:76006 Avg QP:22.19 size: 3141
[libx264 # 0x1c39be0] frame B:62416 Avg QP:26.38 size: 621
[libx264 # 0x1c39be0] consecutive B-frames: 32.3% 17.5% 18.6% 31.6%
[libx264 # 0x1c39be0] mb I I16..4: 24.5% 0.0% 75.5%
[libx264 # 0x1c39be0] mb P I16..4: 7.5% 0.0% 0.0% P16..4: 40.5% 0.0% 0.0% 0.0% 0.0% skip:52.1%
[libx264 # 0x1c39be0] mb B I16..4: 1.4% 0.0% 0.0% B16..8: 12.0% 0.0% 0.0% direct: 2.9% skip:83.7% L0:41.1% L1:41.6% BI:17.3%
[libx264 # 0x1c39be0] final ratefactor: 23.45
[libx264 # 0x1c39be0] direct mvs spatial:95.3% temporal:4.7%
[libx264 # 0x1c39be0] coded y,uvDC,uvAC intra: 37.6% 42.8% 11.8% inter: 8.9% 8.2% 0.5%
[libx264 # 0x1c39be0] i16 v,h,dc,p: 43% 28% 19% 10%
[libx264 # 0x1c39be0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 21% 11% 6% 4% 5% 4% 6% 6%
[libx264 # 0x1c39be0] i8c dc,h,v,p: 57% 19% 20% 4%
[libx264 # 0x1c39be0] Weighted P-Frames: Y:1.4% UV:0.5%
[libx264 # 0x1c39be0] kb/s:503.18
output for the second pass:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'comiccon.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: mp41
creation_time : 2012-08-15 17:12:37
Duration: 01:17:15.93, start: 0.000000, bitrate: 706 kb/s
Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 636 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc
Metadata:
creation_time : 2012-08-15 17:12:37
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 63 kb/s
Metadata:
creation_time : 2012-08-15 17:12:37
handler_name : SoundHandler
Please use -b:a or -b:v, -b is ambiguous
[libx264 # 0x3247f80] using SAR=1/1
[libx264 # 0x3247f80] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 # 0x3247f80] profile High, level 3.0
[libx264 # 0x3247f80] 264 - core 129 r2245 bc13772 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=umh subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=2pass mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 cplxblur=20.0 qblur=0.5 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'comiccon.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: mp41
encoder : Lavf54.61.104
Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, pass 2, 500 kb/s, 15360 tbn, 30 tbc
Metadata:
creation_time : 2012-08-15 17:12:37
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s
Metadata:
creation_time : 2012-08-15 17:12:37
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> libx264)
Stream #0:1 -> #0:1 (aac -> libfaac)
Press [q] to stop, [?] for help
frame=139078 fps=206 q=32766.0 Lsize= 357252kB time=01:17:15.93 bitrate= 631.3kbits/s
video:282992kB audio:69592kB subtitle:0 global headers:0kB muxing overhead 1.324238%
[libx264 # 0x3247f80] frame I:656 Avg QP:19.61 size: 20433
[libx264 # 0x3247f80] frame P:76006 Avg QP:23.07 size: 2996
[libx264 # 0x3247f80] frame B:62416 Avg QP:26.23 size: 780
[libx264 # 0x3247f80] consecutive B-frames: 32.3% 17.5% 18.6% 31.6%
[libx264 # 0x3247f80] mb I I16..4: 17.2% 37.8% 44.9%
[libx264 # 0x3247f80] mb P I16..4: 2.9% 3.7% 1.2% P16..4: 30.3% 6.1% 3.4% 0.0% 0.0% skip:52.5%
[libx264 # 0x3247f80] mb B I16..4: 0.5% 0.6% 0.3% B16..8: 25.9% 2.2% 0.5% direct: 0.9% skip:69.3% L0:51.4% L1:43.0% BI: 5.7%
[libx264 # 0x3247f80] 8x8 transform intra:45.9% inter:51.5%
[libx264 # 0x3247f80] direct mvs spatial:85.5% temporal:14.5%
[libx264 # 0x3247f80] coded y,uvDC,uvAC intra: 47.3% 49.2% 13.5% inter: 9.0% 9.4% 0.5%
[libx264 # 0x3247f80] i16 v,h,dc,p: 38% 27% 13% 22%
[libx264 # 0x3247f80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 16% 14% 5% 5% 7% 7% 8% 9%
[libx264 # 0x3247f80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 15% 9% 6% 7% 8% 7% 8% 8%
[libx264 # 0x3247f80] i8c dc,h,v,p: 49% 22% 20% 8%
[libx264 # 0x3247f80] Weighted P-Frames: Y:1.4% UV:0.5%
[libx264 # 0x3247f80] ref P L0: 79.3% 10.4% 6.8% 1.6% 1.2% 0.7% 0.0%
[libx264 # 0x3247f80] ref B L0: 93.6% 4.8% 1.2% 0.3%
[libx264 # 0x3247f80] ref B L1: 96.6% 3.4%
[libx264 # 0x3247f80] kb/s:500.06
The above command produces the file correctly however it cannot be played in flash player. One thing that I noticed is this may happen if the input file is mp4 as well. This command is executed for users uploading files, so the input file could be any format.
Below is the information about my FFmpeg version:
> ffmpeg version git-2013-02-01-5a67e30 Copyright (c) 2000-2013 the
> FFmpeg developers built on Feb 1 2013 14:23:14 with gcc 4.6
> (Ubuntu/Linaro 4.6.3-1ubuntu5) configuration: --enable-gpl
> --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 libavutil 52. 17.100 / 52. 17.100
libavcodec 54. 91.100 / 54. 91.100
libavformat 54. 61.104 / 54. 61.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 35.100 / 3. 35.100
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.1
Some notes:
The binary is ffmpeg; not FFmpeg or FFMpeg.
-strict experimental should be used as an output option. You are using it as an input option and is being ignored. You won't need it for other AAC encoders.
-threads auto is now default and adding it is superfluous.
You compiled with --enable-libfdk-aac, and therefore you can use -codec:a libfdk_aac which will provide better quality per file size than the other AAC encoders. See the FFmpeg AAC Encoding Guide and FFmpeg and x264 Encoding Guide.
The message Please use -b:a or -b:v, -b is ambiguous should not be ignored so ffmpeg knows if you want to apply your desired bitrate to the audio or video.
I don't see why the second command shouldn't work in a flash player. You may simply not be waiting long enough for the file to download completely before playing. You can add -movflags +faststart to allow playback to begin before the download completes.
Replace -s with the scale filter so you can have a proper filterchain with pad. Next time show actual commands and not commands with variables; otherwise I could have given a proper filtering example.

Resources