Month: September 2015

Testing an RGB LED in the NuttX

This is a small video showing a small driver I did to control an RGB LED in the NuttX running on STM32F4Discovery board:

Advertisements

Listing of GSM Modem AT commands

3GPP TS 27.007 Release 9 145 V9.4.0 (2010-06)

AT+CAAP         7.25            -  Automatic answer for eMLPP Service 
AT+CACM         8.25            -  Accumulated call meter 
AT+CAEMLPP      7.22            -  eMLPP Priority Registration and Interrogation 
AT+CAHLD        11.1.3          -  Leave an ongoing Voice Group or Voice Broadcast Call 
AT+CAJOIN       11.1.1          -  Accept an incoming Voice Group or Voice Broadcast Call 
AT+CALA         8.16            -  Alarm 
AT+CALCC        11.1.6          -  List current Voice Group and Voice Broadcast Calls 
AT+CALD         8.38            -  Delete alarm 
AT+CALM         8.20            -  Alert sound mode 
AT+CAMM         8.26            -  Accumulated call meter maximum 
AT+CANCHEV      11.1.8          -  NCH Support Indication 
AT+CAOC         7.16            -  Advice of Charge 
AT+CAPD         8.39            -  Postpone or dismiss an alarm 
AT+CAPTT        11.1.4          -  Talker Access for Voice Group Call 
AT+CAREJ        11.1.2          -  Reject an incoming Voice Group or Voice Broadcast Call 
AT+CAULEV       11.1.5          -  Voice Group Call Uplink Status Presentation 
AT+CBC          8.4             -  Battery charge 
AT+CBCAP        8.59            -  Battery Capacity 
AT+CBCHG        8.61            -  Battery Charger Status 
AT+CBCON        8.60            -  Battery Connection Status 
AT+CBCS         11.3.2          -  VBS subscriptions and GId status 
AT+CBKLT        8.51            -  Backlight 
AT+CBST         6.7             -  Select bearer service type 
AT+CCFC         7.11            -  Call forwarding number and conditions 
AT+CCHC         8.46            -  Close Logical Channel 
AT+CCHO         8.45            -  Open Logical Channel 
AT+CCLK         8.15            -  Clock 
AT+CCUG         7.10            -  Closed user group 
AT+CCWA         7.12            -  Call waiting 
AT+CCWE         8.28            -  Call Meter maximum event 
AT+CDIP         7.9             -  Called line identification presentation 
AT+CDIS         8.8             -  Display control 
AT+CEAP         8.47            -  EAP authentication 
AT+CEER         6.10            -  Extended error report 
AT+CEMODE       10.1.28         -  UE modes of operation for EPS 
AT+CEPTT        11.1.10         -  Short Data Transmission during ongoing VGCS 
AT+CEREG        10.1.22         -  EPS network registration status 
AT+CERP         8.48            -  EAP Retrieve Parameters 
AT+CFCS         7.24            -  Fast call setup conditions 
AT+CFUN         8.2             -  Set phone functionality 
AT+CGACT        10.1.10         -  PDP context activate or deactivate 
AT+CGATT        10.1.9          -  PS attach or detach 
AT+CGCLASS      10.1.17         -  GPRS mobile station class 
AT+CGCLOSP      10.1.13         -  Configure local Octet Stream PAD parameters 
AT+CGCMOD       10.1.11         -  PDP Context Modify 
AT+CGCONTRDP    10.1.23         -  PDP Context Read Dynamic Parameters 
AT+CGCS         11.3.1          -  VGCS subscriptions and GId status 
AT+CGDATA       10.1.12         -  Enter data state 
AT+CGDCONT      10.1.1          -  Define PDP Context 
AT+CGDSCONT     10.1.2          -  Define Secondary PDP Context 
AT+CGEQOS       10.1.26         -  Define EPS Quality Of Service 
AT+CGEQOSRDP    10.1.27         -  EPS Quality Of Service Read Dynamic Parameters 
AT+CGEREP       10.1.19         -  Packet Domain event reporting 
AT+CGLA         8.43            -  Generic UICC Logical Channel access 
AT+CGMI         5.1             -  Request manufacturer identification 
AT+CGMM         5.2             -  Request model identification 
AT+CGMR         5.3             -  Request revision identification 
AT+CGREG        10.1.20         -  GPRS network registration status 
AT+CGSMS        10.1.21         -  Select service for MO SMS messages 
AT+CGSN         5.4             -  Request product serial number identification 
AT+CGTFT        10.1.3          -  Traffic Flow Template 
AT+CGTFTRDP     10.1.25         -  Traffic Flow Template Read Dynamic Parameters 
AT+CHLD         7.13            -  Call related supplementary services 
AT+CHSC         6.15            -  HSCSD current call parameters 
AT+CHSD         6.12            -  HSCSD device parameters 
AT+CHSR         6.16            -  HSCSD parameters report 
AT+CHST         6.13            -  HSCSD transparent call configuration 
AT+CHSU         6.17            -  HSCSD automatic user initiated upgrading 
AT+CHUP         6.5             -  Hangup call 
AT+CIMI         5.6             -  Request international mobile subscriber identity 
AT+CIND         8.9             -  Indicator control 
AT+CKPD         8.7             -  Keypad control 
AT+CLAC         8.37            -  List all available AT commands 
AT+CLAE         8.31            -  Language Event 
AT+CLAN         8.30            -  Set Language 
AT+CLCC         7.18            -  List current calls 
AT+CLCK         7.4             -  Facility lock 
AT+CLIP         7.6             -  Calling line identification presentation 
AT+CLIR         7.7             -  Calling line identification restriction 
AT+CLVL         8.23            -  Loudspeaker volume level 
AT+CMAR         8.36            -  Master Reset 
AT+CMEC         8.6             -  Mobile Termination control mode 
AT+CMEE         9.1             -  Report mobile termination error 
AT+CMER         8.10            -  Mobile Termination event reporting 
AT+CMOD         6.4             -  Call mode 
AT+CMOLR        8.50            -  Mobile Originated Location Request 
AT+CMOLRE       9.1             -  Report mobile originated location request error 
AT+CMOLRE       9.3             -  Mobile termination error result code 
AT+CMTLR        8.57            -  Mobile Terminated Location Request notification 
AT+CMUT         8.24            -  Mute control 
AT+CMUX         5.7             -  Multiplexing mode 
AT+CNAP         7.30            -  Calling name identification presentation 
AT+CNUM         7.1             -  Subscriber number 
AT+COLP         7.8             -  Connected line identification presentation 
AT+COLR         7.31            -  Connected line identification restriction status 
AT+COPN         7.21            -  Read operator names 
AT+COPS         7.3             -  PLMN selection 
AT+COTDI        11.1.9          -  Originator to Dispatcher Information 
AT+CPAS         8.1             -  Phone activity status 
AT+CPBF         8.13            -  Find phonebook entries 
AT+CPBR         8.12            -  Read phonebook entries 
AT+CPBS         8.11            -  Select phonebook memory storage 
AT+CPBW         8.14            -  Write phonebook entry 
AT+CPIN         8.3             -  Enter PIN 
AT+CPLS         7.20            -  Selection of preferred PLMN list 
AT+CPNET        7.27            -  Preferred network indication 
AT+CPNSTAT      7.28            -  Preferred network status 
AT+CPOL         7.19            -  Preferred PLMN list 
AT+CPOS         8.55            -  Positioning Control 
AT+CPOSR        8.56            -  Positioning Reporting 
AT+CPPS         7.23            -  eMLPP subscriptions 
AT+CPROT        8.42            -  Enter protocol mode
AT+CPSB         7.29            -  Current Packet Switched Bearer 
AT+CPUC         8.27            -  Price per unit and currency table 
AT+CPWC         8.29            -  Power class 
AT+CPWD         7.5             -  Change password 
AT+CR           6.9             -  Service reporting control 
AT+CRC          6.11            -  Cellular result codes 
AT+CREG         7.2             -  Network registration 
AT+CRLA         8.44            -  Restricted UICC Logical Channel access 
AT+CRLP         6.8             -  Radio link protocol 
AT+CRMC         8.34            -  Ring Melody Control 
AT+CRMP         8.35            -  Ring Melody Playback 
AT+CRSL         8.21            -  Ringer sound level 
AT+CRSM         8.18            -  Restricted SIM access 
AT+CSCC         8.19            -  Secure control command 
AT+CSCS         5.5             -  Select TE character set 
AT+CSDF         6.22            -  Settings date format 
AT+CSGT         8.32            -  Set Greeting Text 
AT+CSIL         6.23            -  Silence Command 
AT+CSIM         8.17            -  Generic SIM access 
AT+CSNS         6.19            -  Single numbering scheme 
AT+CSQ          8.5             -  Signal quality 
AT+CSSAC        7.32            -  Service Specific Access Control restriction status 
AT+CSSN         7.17            -  Supplementary service notifications 
AT+CSTA         6.1             -  Select type of address 
AT+CSTF         6.24            -  Settings time format 
AT+CSVM         8.33            -  Set Voice Mail Number 
AT+CTFR         7.14            -  Call deflection 
AT+CTZR         8.41            -  Time Zone Reporting 
AT+CTZU         8.40            -  Automatic Time Zone Update 
AT+CUAD         8.49            -  UICC Application Discovery 
AT+CUSD         7.15            -  Unstructured supplementary service data 
AT+CVHU         6.20            -  Voice Hangup Control 
AT+CVIB         8.22            -  Vibrator mode 
AT+CVMOD        6.4             -  Voice Call Mode 
AT+FCLASS       C.2.1           -  Select mode 
AT+VBT          C.2.2           -  Buffer threshold setting 
AT+VCID         C.2.3           -  Calling number ID presentation 
AT+VGR          C.2.4           -  Receive gain selection 
AT+VGT          C.2.5           -  Transmit gain selection 
AT+VIP          C.2.6           -  Initialise voice parameters 
AT+VIT          C.2.7           -  Inactivity timer 
AT+VLS          C.2.8           -  Line selection 
AT+VRX          C.2.9           -  Receive data state 
AT+VSM          C.2.10          -  Select compression method 
AT+VTD          C.2.12          -  Tone duration 
AT+VTS          C.2.11          -  DTMF and tone generation 
AT+VTX          C.2.13          -  Transmit data state

Source: http://forum.xda-developers.com/galaxy-s2/help/how-to-talk-to-modem-commands-t1471241

Getting started with PPPD on NuttX

NuttX has PPP support to GSM/3G modems, then I decided to test it with UBlox Leon-G100 modem. As you can see on my previous post I was testing the SmartG100 board on Linux to verify if GSM modem is working, because it is working I can follow with NuttX test.

I connected the Leon-G100 to USART2: TX (PD5), RX (PD6), CTS (PD3) and RTS (PD4) then I enabled flow control in the NuttX config:

#
# USART Configuration
#

CONFIG_USART2_ISUART=y
CONFIG_USART6_ISUART=y
CONFIG_MCU_SERIAL=y
CONFIG_STANDARD_SERIAL=y
CONFIG_SERIAL_NPOLLWAITERS=2
CONFIG_SERIAL_IFLOWCONTROL=y
CONFIG_SERIAL_OFLOWCONTROL=y

Also I need to enable some other features:

CONFIG_CLOCK_MONOTONIC=y
CONFIG_NETDEVICES=y
CONFIG_NETDEV_MULTINIC=y
CONFIG_NETDEV_LATEINIT=y

#
# Device Drivers
#

# CONFIG_DISABLE_POLL is not set

#
# Networking Support
#
CONFIG_ARCH_HAVE_NET=y
CONFIG_NET=y

#
# Driver buffer configuration
#
CONFIG_NET_MULTIBUFFER=y
CONFIG_NET_ETH_MTU=590
CONFIG_NET_ETH_TCP_RECVWNDO=536
CONFIG_NET_TUN_MTU=296
CONFIG_NET_TUN_TCP_RECVWNDO=256
CONFIG_NET_GUARDSIZE=2

#
# Data link support
#
CONFIG_NET_MULTILINK=y
# CONFIG_NET_USER_DEVFMT is not set
CONFIG_NET_ETHERNET=y
# CONFIG_NET_LOOPBACK is not set
CONFIG_NET_TUN=y
CONFIG_TUN_NINTERFACES=1

#
# Internet Protocol Selection
#
CONFIG_NET_IPv4=y
# CONFIG_NET_IPv6 is not set
CONFIG_NET_TCP=y
CONFIG_NET_UDP=y
CONFIG_NET_ICMP=y
CONFIG_NET_ARP=y

CONFIG_EXAMPLES_NSH=y
CONFIG_EXAMPLES_PPPD=y

CONFIG_NETUTILS_NETLIB=y
CONFIG_NETUTILS_PPPD=y
CONFIG_NETUTILS_PPPD_STACKSIZE=2048
CONFIG_NETUTILS_PPPD_PAP=y

After compiling and flashing the firmware I tested it:

NuttShell (NSH)
nsh> pppd
tun fd:3
tty fd:4
ipcp init

AHDLC_TX - transmit frame, protocol 0xc021, length 4  offline 0

0x05 0x01 0x00 0x04 


AHDLC_TX - transmit frame, protocol 0xc021, length 4  offline 1

0x05 0x02 0x00 0x04 

chat: char = ~ (0x7E)
chat: char = � (0xFF)
chat: char = } (0x7D)
chat: char = ' (0x27)
chat: char = � (0xC4)
chat: char = % (0x25)
chat: char = } (0x7D)
chat: char = % (0x25)
chat: char = } (0x7D)
chat: char = % (0x25)
chat: char = } (0x7D)
chat: char = $ (0x24)
chat: char = } (0x7D)
chat: char = $ (0x24)
chat: char = = (0x3D)
chat: char = � (0xC7)
chat: char = ~ (0x7E)
chat: char = ~ (0x7E)
chat: char = � (0xFF)
chat: char = } (0x7D)
chat: char = ' (0x27)
chat: char = � (0xC4)
chat: char = % (0x25)
chat: char = } (0x7D)
chat: char = % (0x25)
chat: char = } (0x7D)
chat: char = & (0x26)
chat: char = } (0x7D)
chat: char = $ (0x24)
chat: char = } (0x7D)
chat: char = $ (0x24)
chat: char = ] (0x5D)
chat: char = , (0x2C)
chat: char = ~ (0x7E)
chat: char = + (0x2B)
chat: char = / (0x2F)
chat: char = / (0x2F)
chat: char = A (0x41)
chat: char = T (0x54)
chat: char = E (0x45)
chat: char = 1 (0x31)
 (0x0D)har = 
chat: char = up_assert: Assertion failed at file:armv7-m/up_hardfault.c line: 183
up_dumpstate: sp:         10001b70
up_dumpstate: stack base: 10001d30                                    
up_dumpstate: stack size: 000007e4                                    
up_stackdump: 10001b60: 08000ea9 080129b8 08012938 000007e4 08000ea9 080129b8 08012938 000007e4
up_stackdump: 10001b80: 08000ea9 080129b8 08012938 000007e4 00000000 08000e0b 20002840 080019bb
up_stackdump: 10001ba0: 08012afc 08000c81 00000000 3e656d61 08013c7e 00000000 08013c8b 0800047f
up_stackdump: 10001bc0: 10001c08 00000000 3e656d61 08013c7e 00000000 08013c8b 10001c50 10001c84
up_stackdump: 10001be0: 00000000 00000000 3e656d61 00000073 3e656d61 3e656d62 10001c28 080032c9
up_stackdump: 10001c00: 08002c30 01000000 080010fd 00000000 10001c68 10001c3c 00000000 00000000
up_stackdump: 10001c20: 20002854 08001e09 ffffffff 100012e4 08013c7e 10001c84 10001d40 10001d3c
up_stackdump: 10001c40: 00000000 00000001 00000000 0800f0c9 0800f0e5 0800f0dd 0000000c 100012e4
up_stackdump: 10001c60: 08013c7e 00000004 d3ff7700 0800ebd7 08013c7e 10001c84 3e656d61 08008fdd
up_stackdump: 10001c80: 08013c7e 3e656d61 00007fff 00000000 00000004 0a001d3c 10001d60 00000004
up_stackdump: 10001ca0: 10001d00 10001d00 00000000 00000000 00000000 08008c6f 10001d60 00000004
up_stackdump: 10001cc0: 00000000 08008e55 00000003 00000000 00000001 00000000 00000004 00000000
up_stackdump: 10001ce0: 8768ca01 16f7c8df 10001d10 08013ba4 00000000 00000000 00000000 08008bd3
up_stackdump: 10001d00: 7665642f 7974742f 00003153 00000000 200000e8 200000d4 00000000 00000000
up_stackdump: 10001d20: 00000000 08001d81 00000000 00000000 07ac4948 10001d3c 00000000 6e6f6e3c
up_registerdump: R0: 3e656d61 00000073 3e656d61 3e656d62 3e656d61 08013c7e 00000000 08013c8b
up_registerdump: R8: 10001c50 10001c84 00000000 00000000 10001c28 10001c08 080032c9 08002c30
up_registerdump: xPSR: 01000000 PRIMASK: 00000000 CONTROL: 00000000

Too bad, it crashed!

Looking at PC15 position (0x08002c30) at System.map file I noticed it was crashing at “strlen” function.

Immediately the pap_username and pap_password variables came to my mind.

Then I opened “apps/examples/pppd/pppd_main.c” and noticed there is not an initialization to pap_username and pap_password, I added it:

@@ -87,6 +88,8 @@ int pppd_main(int argc, char *argv[])
     .disconnect_script = &disconnect_script,
     .connect_script = &connect_script,
     .ttyname = "/dev/ttyS2",
+    .pap_username = "tim",
+    .pap_password = "tim",
   };
   return pppd(&pppd_settings);
 }

But the compiler said it don’t know about pap_username and pap_password, after inspecting “apps/include/netutils/pppd.h” I noticed it depends on NETUTILS_PPPD_PAP to include them to struct. Then I enabled the “PPP PAP Authentication Support” in the NuttX menu config.

This time “pppd” worked as expected:

 
nsh> pppd
tun fd:3
tty fd:4
ipcp init

AHDLC_TX - transmit frame, protocol 0xc021, length 4  offline 0

0x05 0x01 0x00 0x04 


AHDLC_TX - transmit frame, protocol 0xc021, length 4  offline 1

0x05 0x02 0x00 0x04 

chat: char = ~ (0x7E)
chat: char = � (0xFF)
chat: char = } (0x7D)
chat: char = ' (0x27)
chat: char = � (0xC4)
chat: char = % (0x25)
chat: char = } (0x7D)
chat: char = % (0x25)
chat: char = } (0x7D)
chat: char = % (0x25)
chat: char = } (0x7D)
chat: char = $ (0x24)
chat: char = } (0x7D)
chat: char = $ (0x24)
chat: char = = (0x3D)
chat: char = � (0xC7)
chat: char = ~ (0x7E)
chat: char = ~ (0x7E)
chat: char = � (0xFF)
chat: char = } (0x7D)
chat: char = ' (0x27)
chat: char = � (0xC4)
chat: char = % (0x25)
chat: char = } (0x7D)
chat: char = % (0x25)
chat: char = } (0x7D)
chat: char = & (0x26)
chat: char = } (0x7D)
chat: char = $ (0x24)
chat: char = } (0x7D)
chat: char = $ (0x24)
chat: char = ] (0x5D)
chat: char = , (0x2C)
chat: char = ~ (0x7E)
chat: char = + (0x2B)
chat: char = / (0x2F)
chat: char = / (0x2F)
chat: char = A (0x41)
chat: char = T (0x54)
chat: char = E (0x45)
chat: char = 1 (0x31)
 (0x0D)har = 
 (0x0D)har = 
chat: char = 
 (0x0A)
chat: char = O (0x4F)
chat: char = K (0x4B)
 (0x0D)har = 
chat: char = 
 (0x0A)
chat: send 'ATZ`
chat: char = A (0x41)
chat: char = T (0x54)
chat: char = Z (0x5A)
chat: wait for 'OK`
 (0x0D)har = 
 (0x0D)har = 
chat: char = 
 (0x0A)
chat: char = O (0x4F)
chat: char = K (0x4B)
chat: got it!
 (0x0D)har = 
chat: char = 
 (0x0A)
chat: send 'AT`
chat: char = A (0x41)
chat: char = T (0x54)
chat: wait for 'OK`
 (0x0D)har = 
 (0x0D)har = 
chat: char = 
 (0x0A)
chat: char = O (0x4F)
chat: char = K (0x4B)
chat: got it!
 (0x0D)har = 
chat: char = 
 (0x0A)
chat: send 'AT+IFC=0,0`
chat: char = A (0x41)
chat: char = T (0x54)
chat: char = + (0x2B)
chat: char = I (0x49)
chat: char = F (0x46)
chat: char = C (0x43)
chat: char = = (0x3D)
chat: char = 0 (0x30)
chat: char = , (0x2C)
chat: char = 0 (0x30)
chat: wait for 'OK`
 (0x0D)har = 
 (0x0D)har = 
chat: char = 
 (0x0A)
chat: char = O (0x4F)
chat: char = K (0x4B)
chat: got it!
 (0x0D)har = 
chat: char = 
 (0x0A)
chat: send 'AT+CGDCONT = 1,"IP","tim.br"`
chat: char = A (0x41)
chat: char = T (0x54)
chat: char = + (0x2B)
chat: char = C (0x43)
chat: char = G (0x47)
chat: char = D (0x44)
chat: char = C (0x43)
chat: char = O (0x4F)
chat: char = N (0x4E)
chat: char = T (0x54)
chat: char =   (0x20)
chat: char = = (0x3D)
chat: char =   (0x20)
chat: char = 1 (0x31)
chat: char = , (0x2C)
chat: char = " (0x22)
chat: char = I (0x49)
chat: char = P (0x50)
chat: char = " (0x22)
chat: char = , (0x2C)
chat: char = " (0x22)
chat: char = t (0x74)
chat: char = i (0x69)
chat: char = m (0x6D)
chat: char = . (0x2E)
chat: char = b (0x62)
chat: char = r (0x72)
chat: char = " (0x22)
chat: wait for 'OK`
 (0x0D)har = 
 (0x0D)har = 
chat: char = 
 (0x0A)
chat: char = O (0x4F)
chat: char = K (0x4B)
chat: got it!
 (0x0D)har = 
chat: char = 
 (0x0A)
chat: send 'ATD*99***1#`
chat: char = A (0x41)
chat: char = T (0x54)
chat: char = D (0x44)
chat: char = * (0x2A)
chat: char = 9 (0x39)
chat: char = 9 (0x39)
chat: char = * (0x2A)
chat: char = * (0x2A)
chat: char = * (0x2A)
chat: char = 1 (0x31)
chat: char = # (0x23)
chat: wait for 'CONNECT`
 (0x0D)har = 
 (0x0D)har = 
chat: char = 
 (0x0A)
chat: char = C (0x43)
chat: char = O (0x4F)
chat: char = N (0x4E)
chat: char = N (0x4E)
chat: char = E (0x45)
chat: char = C (0x43)
chat: char = T (0x54)
chat: got it!
ipcp init
ipcp init

Sending LCP request packet -  len 10

AHDLC_TX - transmit frame, protocol 0xc021, length 10  offline 0

0x01 0x00 0x00 0x0a 0x02 0x06 0xff 0xff 0xff 0xff 


Receiving packet with good crc value, len 24

0x01 0x01 0x00 0x14 0x02 0x06 0x00 0x00 0x00 0x00 0x05 0x06 0xed 0xb6 0x5b 0x05 
0x07 0x02 0x08 0x02 

LCP Packet - ipcp init
received [LCP Config Request id 1
   
Send ACK!
Writing ACK frame 

AHDLC_TX - transmit frame, protocol 0xc021, length 20  offline 1

0x02 0x01 0x00 0x14 0x02 0x06 0x00 0x00 0x00 0x00 0x05 0x06 0xed 0xb6 0x5b 0x05 0x07 0x02 0x08 0x02 

- end ACK Write frame


Receiving packet with good crc value, len 14

0x02 0x00 0x00 0x0a 0x02 0x06 0xff 0xff 0xff 0xff 

LCP Packet - LCP-ACK - >>>>>>>> good ACK id up! 0


**Sending IPCP Request packet

AHDLC_TX - transmit frame, protocol 0x8021, length 10  offline 0

0x01 0x00 0x00 0x0a 0x03 0x06 0x00 0x00 0x00 0x00 


Receiving packet with good crc value, len 14

0x01 0x01 0x00 0x0a 0x03 0x06 0xb3 0x4e 0xef 0x1a 

IPCP Packet - IPCP len 10
check lcplist
IPCP options are good
Peer IP 
Send IPCP ACK!
SET- stuff -- are we up? c=10 dif=2 
Writing ACK frame 

AHDLC_TX - transmit frame, protocol 0x8021, length 10  offline 1

0x02 0x01 0x00 0x0a 0x03 0x06 0xb3 0x4e 0xef 0x1a 

- End ACK Write frame


Receiving packet with good crc value, len 14

0x03 0x00 0x00 0x0a 0x03 0x06 0xb3 0x4e 0xef 0x1a 

IPCP Packet - IPCP len 10
CONF NAK



**Sending IPCP Request packet

AHDLC_TX - transmit frame, protocol 0x8021, length 10  offline 0

0x01 0x01 0x00 0x0a 0x03 0x06 0xb3 0x4e 0xef 0x1a 


Receiving packet with good crc value, len 14

0x02 0x01 0x00 0x0a 0x03 0x06 0xb3 0x4e 0xef 0x1a 

IPCP Packet - IPCP len 10
CONF ACK
were up! 


 len 8

Writing ECHO-REQUEST frame 

AHDLC_TX - transmit frame, protocol 0xc021, length 8  offline 0

0x09 0x01 0x00 0x08 0x00 0x00 0x00 0x00 

- end ECHO-REQUEST Write frame

Receiving packet with good crc value, len 12

0x0a 0x01 0x00 0x08 0xed 0xb6 0x5b 0x05 

LCP Packet - LCP-ECHO REPLY

 len 8

Writing ECHO-REQUEST frame 

AHDLC_TX - transmit frame, protocol 0xc021, length 8  offline 0

0x09 0x02 0x00 0x08 0x00 0x00 0x00 0x00 

- end ECHO-REQUEST Write frame

Receiving packet with good crc value, len 12

0x0a 0x02 0x00 0x08 0xed 0xb6 0x5b 0x05 

LCP Packet - LCP-ECHO REPLY

 len 8

Writing ECHO-REQUEST frame 

AHDLC_TX - transmit frame, protocol 0xc021, length 8  offline 0

0x09 0x03 0x00 0x08 0x00 0x00 0x00 0x00 

- end ECHO-REQUEST Write frame

Receiving packet with good crc value, len 12

0x0a 0x03 0x00 0x08 0xed 0xb6 0x5b 0x05 

LCP Packet - LCP-ECHO REPLY

 len 8

Writing ECHO-REQUEST frame 

AHDLC_TX - transmit frame, protocol 0xc021, length 8  offline 0

0x09 0x04 0x00 0x08 0x00 0x00 0x00 0x00 

- end ECHO-REQUEST Write frame

Receiving packet with good crc value, len 12

0x0a 0x04 0x00 0x08 0xed 0xb6 0x5b 0x05 

LCP Packet - LCP-ECHO REPLY

 len 8

Writing ECHO-REQUEST frame 

AHDLC_TX - transmit frame, protocol 0xc021, length 8  offline 0

0x09 0x05 0x00 0x08 0x00 0x00 0x00 0x00 

- end ECHO-REQUEST Write frame

Receiving packet with good crc value, len 12

0x0a 0x05 0x00 0x08 0xed 0xb6 0x5b 0x05 

LCP Packet - LCP-ECHO REPLY

 len 8

Writing ECHO-REQUEST frame 

AHDLC_TX - transmit frame, protocol 0xc021, length 8  offline 0

0x09 0x06 0x00 0x08 0x00 0x00 0x00 0x00 

- end ECHO-REQUEST Write frame

Receiving packet with good crc value, len 12

0x0a 0x06 0x00 0x08 0xed 0xb6 0x5b 0x05 

LCP Packet - LCP-ECHO REPLY

 len 8

Writing ECHO-REQUEST frame 

AHDLC_TX - transmit frame, protocol 0xc021, length 8  offline 0

0x09 0x07 0x00 0x08 0x00 0x00 0x00 0x00 

- end ECHO-REQUEST Write frame

Receiving packet with good crc value, len 12

0x0a 0x07 0x00 0x08 0xed 0xb6 0x5b 0x05 

LCP Packet - LCP-ECHO REPLY

 len 8

Writing ECHO-REQUEST frame 

AHDLC_TX - transmit frame, protocol 0xc021, length 8  offline 0

0x09 0x08 0x00 0x08 0x00 0x00 0x00 0x00 

- end ECHO-REQUEST Write frame

Receiving packet with good crc value, len 12

0x0a 0x08 0x00 0x08 0xed 0xb6 0x5b 0x05 

LCP Packet - LCP-ECHO REPLY

 len 8

Writing ECHO-REQUEST frame 

AHDLC_TX - transmit frame, protocol 0xc021, length 8  offline 0

0x09 0x09 0x00 0x08 0x00 0x00 0x00 0x00 

- end ECHO-REQUEST Write frame

Receiving packet with good crc value, len 12

0x0a 0x09 0x00 0x08 0xed 0xb6 0x5b 0x05 

LCP Packet - LCP-ECHO REPLY

 len 8

Writing ECHO-REQUEST frame 

AHDLC_TX - transmit frame, protocol 0xc021, length 8  offline 0

0x09 0x0a 0x00 0x08 0x00 0x00 0x00 0x00 

- end ECHO-REQUEST Write frame

Receiving packet with good crc value, len 12

0x0a 0x0a 0x00 0x08 0xed 0xb6 0x5b 0x05 

LCP Packet - LCP-ECHO REPLY

 len 8

Writing ECHO-REQUEST frame 

AHDLC_TX - transmit frame, protocol 0xc021, length 8  offline 0

0x09 0x0b 0x00 0x08 0x00 0x00 0x00 0x00 

- end ECHO-REQUEST Write frame

Receiving packet with good crc value, len 12

0x0a 0x0b 0x00 0x08 0xed 0xb6 0x5b 0x05 

LCP Packet - LCP-ECHO REPLY

 len 8

Writing ECHO-REQUEST frame 

AHDLC_TX - transmit frame, protocol 0xc021, length 8  offline 0

0x09 0x0c 0x00 0x08 0x00 0x00 0x00 0x00 

- end ECHO-REQUEST Write frame

Receiving packet with good crc value, len 12

0x0a 0x0c 0x00 0x08 0xed 0xb6 0x5b 0x05 

LCP Packet - LCP-ECHO REPLY

Now let see the IP we got:

nsh> ifconfig
tun0    Link encap:TUN at UP
        inet addr:100.96.114.232 DRaddr:100.96.114.232 Mask:0.0.0.0

Hacking MikroElektronika SmartG100 board and connecting to GPRS

I was testing a MikroElektronika SmartG100 board and was facing some issues to get its serial line working.

“Fortunately” many people suffered from same issue before me:

http://www.mikroe.com/forum/viewtopic.php?f=12&t=52587
http://www.mikroe.com/forum/viewtopic.php?f=12&t=46858
https://www.mikroe.com/forum/viewtopic.php?f=12&t=47018

If you read all the threads, the conclusion is: “you need to supply an external 5V and GND in to connector CN2”. This is not for me!

Looking at SmartG100 schematic in the last pages of its manual I noticed there are two transistors BJTs for each signal (TXD, RXD, CTS and RTS) used as level shifter.

Then if I remove R5 I could connect my USB/Serial RXD pin to SmartG100 RXD signal, same apply to R14, removing it I could to connect USB/Serial CTS to it.

But for TXD I need to remove R10 and Q4 transistor and connect the USB Serial TXD pin to TXD signal. And same to RTS, removing R13 and Q6 I could to connect USB/Serial RTS pin to RTS signal.

Then I proceed!!! And the serial line worked and I can issue some commands in the minicom terminal:

ATZ                                                                          
OK                                                                           
AT+CGMI                                                                      
u-blox
OK

Now, I could use wvdial to connect to the Internet!

Edit /etc/wvdial.conf:

$ vi /etc/wvdial.conf

[Dialer Defaults]
Phone =
Username =
Password =
New PPPD = yes

[Dialer tim]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+IFC=0,0
Init4 = AT+CGDCONT=1,"ip","tim.br"
Stupid Mode = 1
ISDN = 0
Phone = *99***1#
Ask Password = 0
Modem = /dev/ttyUSB0
Username = tim
Dial Command = ATD
Password = tim
Baud = 115200

Finally call wvdial to connect:

$ sudo wvdial tim
--> WvDial: Internet dialer version 1.61
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+IFC=0,0
AT+IFC=0,0
OK
--> Sending: AT+CGDCONT=1,"ip","tim.br"
AT+CGDCONT=1,"ip","tim.br"
OK
--> Modem initialized.
--> Sending: ATD*99***1#
--> Waiting for carrier.
ATD*99***1#
CONNECT
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Fri Sep  4 18:24:42 2015
--> Pid of pppd: 11395
--> Using interface ppp0
--> local  IP address 100.88.170.54
--> remote IP address 100.88.170.54
--> primary   DNS address 189.40.198.81
--> secondary DNS address 189.40.198.80

P.S.: If you don’t want to use flow control, add “AT+IFC=0,0” to init strings, but wvdial source code needs to be modified because it uses flow control by default.

That’s all folks!

Playing two audio languages of movies at same time

I’m looking for a way to play two audio languages at same time each one in a different audio card.

I want to watch movies in the original language (English), but my wife likes to watch it dubbed in Portuguese. Then my idea is to use VLC (or other good video player) to play the English audio in the main Laptop audio card and the dubbed audio in the HDMI audio card.

Then I could use a headphone to listen the original audio track while she listen the dubbed audio in the TV over HDMI.

I didn’t find a solution yet, but found some interesting info:
https://wiki.videolan.org/Play_external_audio_track_with_video/

Also I could open two VLC instance and try to play each only using a different audio card, but it should be nice to have some automatic option.

Any suggestion is welcome!

Update: Someone faced this same issue about 7 (SEVEN!) years ago: http://forums.kmplayer.com/forums/showthread.php?t=12050

Fixing KiCAD library not found issue

I was receiving this kind IO_ERROR when importing the netlist and want trying to update the component:

Errors were encountered loading footprints
IO_ERROR: http GET command failed
Cannot get/download Zip archive: 'https://codeload.github.com/KiCad/Capacitors.pretty/zip/master'
for library path: 'https://github.com/KiCad/Capacitors.pretty'.
Reason: 'Not found'
from /build/kicad-_Y8vIm/kicad-0.201508300901+6132~28~ubuntu14.04.1/kicad/pcbnew/github/github_plugin.cpp : remote_get_zip() : line 584
IO_ERROR: http GET command failed
Cannot get/download Zip archive: 'https://codeload.github.com/KiCad/Iut.pretty/zip/master'
for library path: 'https://github.com/KiCad/Iut.pretty'.
Reason: 'Not found'
from /build/kicad-_Y8vIm/kicad-0.201508300901+6132~28~ubuntu14.04.1/kicad/pcbnew/github/github_plugin.cpp : remote_get_zip() : line 584

This error happen because some libraries are not listed in the fp-lib-table, but you can fix it this way:

1) Open PCBNew, go to “Preferences” -> “Footprint Library Manager”;

2) In “Global Libraries” tab click in the first column/row (Nickname/1), then press Ctrl+A and then Ctrl+X, keep this window opened;

3) Open the link https://raw.githubusercontent.com/KiCad/kicad-library/master/template/fp-lib-table.for-github then Ctrl+A to select all and Ctrl+C to copy it;

4) Return to “Footprint Libray Manager” window and press Ctrl+V to paste the new libraries listing;

5) Press OK button to save it.

Source: https://lists.launchpad.net/kicad-developers/msg14032.html