Friday, 29 July 2016

[Solution] How to embed images from dropbox in blogger

When we try to embed images uploaded in dropbox in your blog, when composing with Blogger.com.

Your public link will not work. As your link may look as below -

INCORRECT : https://www.dropbox.com/s/fbgl0r024v4vmbd/Android%20N%20Error.png?dl=0

This is not a actual link instead an embedded page. To resolve this  you postfix ?raw=1 in your URL and the problem will be resolved.

The new URL looks as below

CORRECT : https://www.dropbox.com/s/fbgl0r024v4vmbd/Android%20N%20Error.png?raw=1

Happy Blogging !!

[Android Studio] Solution : Android N requires the IDE to be running with JDK 1.8


Android N Requires the IDE To be running with Java 1.8 or later. Install a supported JDK.

Eventhough we install the JDK 1.8, this error comes up, and we are not able to work on Design view of a Mobile Phone.






Solution to the Problem :

Found a solution here http://stackoverflow.com/questions/35928580/android-n-requires-the-ide-to-be-running-with-java-1-8-or-later/35935433#35935433


  • Quit Android Studio
  • Edit the file /Applications/Android\ Studio.app/Contents/Info.plist
  • remove the versions and change it to 1.8
  • The changes in my file looks as below
      <key>JVMVersion</key>
      <string>1.8</string>

  • Restart Android Studio.

Now the problem will be resolved in the Design view of the Activity View


Wednesday, 15 June 2016

Run Pinned Shortcut in Taskbar as Administrator in Windows

Luckily you can set Run as administrator option from the shortcut in this case.
  1. Right-click the shortcut in your task bar.
  2. Right-click the program's name (say Command prompt for instance)
  3. Click on Properties.
  4. Click the Shortcut tab.
  5. Click the Advanced... ...
  6. Check the Run as administrator check box.
  7. Click the OK button.

Monday, 6 July 2015

[MCU] Microcontroller Packaging

QFN : Quad Flat No Leads:

These connect IC's to PCB's without through-holes.
The figure shows with lead frame and wire bonding. Flat no-lead packages include an exposed thermal pad to improve heat transfer out of the IC (into the PCB).  Hand soldering is not possible with this package




QFP: Quad Flat Package

A surface mounted IC, pins extending for all the 4 sides.  Socketing such packages is rare and through-hole mounting is not possible.




LQFP: Low Profile Quad Flat Package (1.4mm)



TQFP: Thin Quad Flat Package (1.0 mm) 

Has shorter leads than the LQFP. To be used in a space constrained designs.
Helps in solving increased board density.

References

https://en.wikipedia.org/wiki/Quad_Flat_No-leads_package
https://en.wikipedia.org/wiki/Quad_Flat_Package


Friday, 12 June 2015

[Exploring Freescale MCU Programming] #5 RTC (Real time clock) set and Time and alarm

#2 -  next one in my pipeline is Realtime Clock (RTC) initialize and get it working.

What is RTC?


real-time clock (RTC) is a computer clock (most often in the form of an integrated circuit) that keeps track of the current time. Although the term often refers to the devices in personal computers,servers and embedded systems, RTCs are present in almost any electronic device which needs to keep accurate time.

RTC in K20D Freescale Board


The Real Time Clock (RTC) module on the K20 has two modes of operation, system power‐up and system power‐ down. In system power‐up mode, the RTC may be powered by either the MCU regulator or the backup power supply, VBAT. During system power‐down, the RTC is only powered from the backup power supply, VBAT


I have used RTC with a FRDM-K20D50 Board to schedule an alarm at regular intervals.



The CPU Settings should enable the RTC Oscillator. Otherwise RTC will not work.




RTC Component added.



Setting Properties for the RTC Component



Now lets add the code to set the RTC time and get it back, the main.c


Code to set and get time

printf("--Test init--\n");
LDD_RTC_TTime ttime;
ttime.Day = 11;
ttime.Month = 06;
ttime.Year = 2015;
ttime.Hour = 17;
ttime.Minute = 45;
ttime.Second = 15;

RTC1_SetTime(NULL, &ttime);


int i;
for(i=1;i<=3000000;i++)
{

}

LDD_RTC_TTime ttime1;
RTC1_GetTime(NULL, &ttime1);

printf("%d-%d-%d %d:%d:%d\n", ttime1.Day, ttime1.Month, ttime1.Year, ttime1.Hour, ttime1.Minute, ttime1.Second);



Output

--Test init--
11-6-2015 17:45:16


- Printed the RTC time that is set

Lets try setting RTC alarm and triggering it

Enable the methods setAlarm and enable onAlarm Event and generate code



main.c

ttime1.Second += 30;

RTC1_SetAlarm(NULL, &ttime);

Event.c

void RTC1_OnAlarm(LDD_TUserData *UserDataPtr)
{
printf("---Alarm Triggered--\n");
LDD_RTC_TTime ttime1;
RTC1_GetTime(NULL, &ttime1);

printf("%d-%d-%d %d:%d:%d\n", ttime1.Day, ttime1.Month, ttime1.Year,
ttime1.Hour, ttime1.Minute, ttime1.Second);

}


Output after alarm


---Alarm Triggered--
11-6-2015 17:45:26


Project:


Wednesday, 20 May 2015

[Codewarrior 10.6 Solution] printf(%f) Does not work

printf("-Value %f\n", floatValue) -   prints -Value %f as such, instead of the float value in the console.

Solution :  Change a project settings

Project   ->   Properties  ->  C/C++  Build  ->  Settings  ->  Tool Settings Tab ->  Librarian  -> 

Change print formats  to int_FP



Thursday, 30 April 2015

[Freescale K20D50M MCU Programming] #4 External LED controlled by a GPIO Switch

#4 External LED  controlled by a GPIO Switch

We tried blinking of an LED. Now we will create a switch using one of the GPIO Pins.  The Reset Button in FRDM-K20D50 does not have an alternate function. Hence I wanted to try out a Input switch.

Take a look at the [Freescale K20D50M MCU Programming] #1 Helloworld on the Console using Processor Expert  for quickstart 

Lets get started.


First we need 2 things. 


  • Identify the PIN for the external LED and a ground pin
  • then another PIN to act as a Switch Input and a ground pin

I identified PTC0  and PTB2 respectively.






to see the schematic to identify the PINS.  There is a good youtube video which gives an example on K25Z board.


Next we will be adding the BITIO_LDD for the LDD configured to the PTC0 PIN.




Then a BITIO_LDD for the switch on PTB2



Setting up the BITIO_LDD isn't enough for the acting with in PTB2.  We need to initialize the GPIO for the PIN. We will add a init_GPIO component and configure it to PTB




Generate the Pex code, and then add then lets add the below logic to toggle the led based on whether a wire between PTB2 and the GRND is connected or not..


The Pin's are connected to cathode, so 0 means high and 1 means low.

Code in main.c 

  for(;;)
  {
  if(SW1_GetVal(NULL)==0)   // CONNECTED 
  {
  led_SetVal(led_DeviceData);
  }
  else
  {
  led_ClrVal(led_DeviceData);
  }
  WAIT1_Waitms(1000);
  }


Now build the code and lets test it. 

Here is how the pins are connected on the board




Now lets see what happens with ehe pins at PTB0 is connected, the red wires on the top side is connected.. and you see the LED glowing


Now lets see what happens when one of the wire on top is pulled out..

Do you see only 1 wire on top is connected, and the LED is off.

This is an example of how you use a GPIO pin as a switch to control through software.