Jump to content
43oh

What are you doing right now..?


Recommended Posts

  • Replies 108
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

@@timotet - nice result from isolation milling.   The first machine I made is a fairly standard CNC mill, ballscrews, linear rails & steppers, using Mach3 and Vectric Cut2D & VCarve in the t

Making my first PCB using KiCAD, switching over from ZenitPCB. Next I am going make a prototype board with a LQFP-64 (TM4C123), will push my homemade PCB "printer" to its limits (its inherent resoluti

Seems to sell like hotcakes, the UPS man just dropped a Baofeng UV-5R+ on my doorstep I hope to use it as a test signal  to fiddle with my AIS project. (Carrier signal only, I don't think it is able

Posted Images

I'll start. 

I have a Baofeng UV-B5 radio($30) that I use as a scanner and listen to hams in my area. My model comes with a flash flight button which is disabled, but used on a similar model. I came across this link to connect that button to control the LCD backlight on/off, which is great, so I can see the screen at night, and consumes only 10ma.

 

baofeng_uv-b5-flashlight_mod_bacllight_lcd.JPG

Success!

 

Link to post
Share on other sites

I did not get the filesystem part.

 

Writing a Nokia 1202 driver for TivaWare native C, and debugging it before proceeding to write Newlib stdio stubs so it can take printf() et al.... and pondering a simple "filesystem" concept with those newlib stubs too.

 

Figure the Tiva has the grunt to make it happen.

Link to post
Share on other sites

I did not get the filesystem part.

Well regardless, looks like I was successful! :D

post-15991-0-17807000-1390870369_thumb.jpg

 

Anyway, short story is... Newlib implements the typical POSIX crap for stdio, like open(), close(), write(), read() and stdio like fopen, fclose, fprintf, printf ...

 

But the bottom line is, it leaves the implementation of the generics open(), close(), write(), read() etc (a few it needs in addition; isatty() and lseek()) to the end-user.  If you make use of any of the stdio crap like fopen, printf ... GCC will crash with linker errors that it can't find the requisite _open(), _close() etc symbols.

 

So I got a simple driver together (based on something I did for the Renesas RX, based on something else I saw written up about newlib stubs) that takes filenames and provides file descriptors... using a lookup table including struct's that have a const char *name it can compare the "filename" to to see if that driver has what the user wants.  In this instance, the Nokia 1202 driver I wrote responds to filenames "LCD" and "LCDBACKLIT" by running nokia1202_init() and/or nokia1202_backlight(true), then returns STDOUT_FILENO as its return value.  Then running printf("Hi there!") suddenly "just works".  E.g. the pic I just posted :D

 

Here's the TivaWare program I just wrote (a bit ugly since it uses in-line SysTick stuff to implement the RESET delay)-

/* nokia1202.c
 */

// needed for driverlib rom stuff
#define TARGET_IS_BLIZZARD_RA1 1

#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include "inc/tm4c123gh6pm.h"
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/pin_map.h"
#include "driverlib/gpio.h"
#include "driverlib/ssi.h"

#include "nokia1202_drv.h"
#include "ste2007.h"
#include "font_5x7.h"

int main()
{
    MAP_SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL |
                       SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);  // 80MHz CPU; speed is calculated as 200MHz/SYSDIV

    // SPI, GPIO config for Nokia 1202 LCD
    MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    MAP_GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_6);
    // Default chipselect state = HIGH (deselect), default backlight = LOW (OFF)
    MAP_GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_6, GPIO_PIN_5);

    MAP_GPIOPinConfigure(GPIO_PB4_SSI2CLK);
    MAP_GPIOPinConfigure(GPIO_PB6_SSI2RX);
    MAP_GPIOPinConfigure(GPIO_PB7_SSI2TX);
    MAP_GPIOPinTypeSSI(GPIO_PORTB_BASE, (GPIO_PIN_4 | GPIO_PIN_6 | GPIO_PIN_7));

    MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
    MAP_SSIConfigSetExpClk(SSI2_BASE, MAP_SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 4000000, 9);
    MAP_SSIEnable(SSI2_BASE);

    // Need at least 250ms reset + 250ms wait before Nokia LCD is ready to receive commands
    ROM_SysTickPeriodSet(80000*125);
    ROM_SysTickIntDisable();
    HWREG(NVIC_ST_CURRENT_R) = 1;
    ROM_SysTickEnable();
    while (ROM_SysTickValueGet() < 10000) ;
    while (ROM_SysTickValueGet() > 10000) ;
    ROM_SysTickDisable();

    HWREG(NVIC_ST_CURRENT_R) = 1;
    ROM_SysTickEnable();
    while (ROM_SysTickValueGet() < 10000) ;
    while (ROM_SysTickValueGet() > 10000) ;
    ROM_SysTickDisable();

    MAP_GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_6,GPIO_PIN_6); // drive LCD_RESET HIGH pulling LCD out of RESET
    HWREG(NVIC_ST_CURRENT_R) = 1;
    ROM_SysTickEnable();
    while (ROM_SysTickValueGet() < 10000) ;
    while (ROM_SysTickValueGet() > 10000) ;
    ROM_SysTickDisable();

    HWREG(NVIC_ST_CURRENT_R) = 1;
    ROM_SysTickEnable();
    while (ROM_SysTickValueGet() < 10000) ;
    while (ROM_SysTickValueGet() > 10000) ;
    ROM_SysTickDisable();

    // Display ready for init
    fopen("LCDBACKLIT", "w");
    printf("Hi there, using printf!\n");
    //nokia1202_puts("Hi there!\n");

    while(1) ;
}

Main thing to note is the last little part :)

I requested the library initialize the LCD simply by using fopen("LCDBACKLIT", "w");.

Slowly pondering the utility of implementing all my programs using these sort of primitives... like a very lightweight O/S layer for my stuff.

Link to post
Share on other sites

Unfortunately, not much with electronics. Mostly using the temp monitoring system I put together with a launchpad and a bunch of ds28B20's to track down air leaks in my house and fill them. 8 channels on port 2 rather than using the id of each unit. As Arlo Guthery said, "I'm not proud... or tired". Te code is ugly. May post when I get time to clean it up. Not at all efficient, but I whaled it together in a few hours, using a serial LCD i picked up for $1 at radio shack clearance (parallax 16X4line). Way too much timing by delay_cycles.

 

I really don't like 5degF weather.

Link to post
Share on other sites

My current "night time coding projects" are:

(1) implementing AES128-CCM cipher for non-aligned frames.

(2) Building a binary serial terminal app in pure, POSIX C for good-old command line shell.  Why is it that all the binary serial terminals are married to one horrible OO graphical framework or another?

 

I do enough hardware stuff during the day.  :)

Link to post
Share on other sites

Generating gerbers for a super-secret project :)  @@bluehash knows what I'm talking about - unfortunately the rest of you will be out of the loop for a bit!

@@cubeberg : The jagged line maked me guess this is a touch slider. The H on it's side below a C(?) on it's side makes me guess it's some form of HVAC or hottub control. How close am I? :)

Link to post
Share on other sites

My current "night time coding projects" are:

(1) implementing AES128-CCM cipher for non-aligned frames.

(2) Building a binary serial terminal app in pure, POSIX C for good-old command line shell. Why is it that all the binary serial terminals are married to one horrible OO graphical framework or another?

 

I do enough hardware stuff during the day. :)

As much as I despise Solaris, the "tip" command was rather nice. I just use minicom under linux but even it uses the fullscreen-terminal ncurses library.

 

Sent from my Galaxy Note II with Tapatalk 4

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...