We have been publishing as a binary the firmware for the ARMweb, this has helped us develop the TCPIP and related code for the ARMs. We are now going to publish the firmware for BASIC on the DINkit USB, which is a generic LPC2138, so this should be usable by hobbyists/educators on nearly any LPC2138 or LPC2148 board. The firmware is still copyrighted, so if you want to use it in a commercial product contact us about a nominal licensing fee ($500).
firmware updated to 7.70 below
BASIC firmware for LPC2138
Re: BASIC firmware for LPC2138
from the Yahoo Forum --
Hello BasicNode,
It is ArmBASIC Kernel 7.57. It is a USB DIN kit.
Also, all the Digital inputs on the flexible IO's seem to be registering and
changing correctly.
The six AD inputs that I am trying to convert to Digital inputs are all
registering (-1).
I noticed I had stopped receiving the forum on Yahoo.
Thanks
Carl
From: basicnode <bruce@coridium.us>
To: ARMexpress@yahoogroups.com
Sent: Friday, May 10, 2013 5:09 PM
Subject: [ARMexpress] Re: Trouble Changing AD pins to Digital IO
Which version of firmware are you using? Is it USB or Ethernet connected?
Firmware version reported in the Welcome message, which appears when you hit
STOP in BASICtools
brucee
PS, I'm going to move this to the Coridium Forum, Yahoo seems to be trying to
kill off the Groups
www.coridium.us/forum
--- In ARMexpress@yahoogroups.com, "klug.carl" <klug.carl@...> wrote:
>
> I am using a Bourns 4116R LF 101-1 resistor array.
> It is installed in the R15 location with Pin 1 adjacent to the C4 marking on
the board.
> This is how I have it written in my program.
> #include "LPC21xx.bas"
> PINSEL1 AND= &HC003FFFF
> FIO1DIR OR= 1<<16
> FIO1DIR OR= 1<<17 'Open Fr Lat Mot
> FIO1DIR OR= 1<<18 'Close Fr Lat Mot
> FIO1DIR OR= 1<<19 'PM-2 Raise Rear Rail
> FIO1DIR OR= 1<<20 'PM-1 Lower Rear Rail
> FIO1DIR OR= 1<<21 'Valve 1
> FIO1DIR OR= 1<<22 'Valve 2
> FIO1DIR OR= 1<<23 'Valve 3
>
> From ArmBASIC Help
> "D pins are configured as ADs. To return them to IOs, the PINSEL register
needs to be written (details in the NXP LPC2138 User Manual)
>
> PINSEL1 AND= &HC003FFFF ' return ADs to IOs"
>
> Is it also necessary to set the IO up like is says for BASICchip
> 'x = IO(11) ' make AD(0) an IO
> x = IO(32) ' make AD(1) an IO
> x = IO(33) ' make AD(2) an IO
> x = IO(34) ' make AD(3) an IO
> x = IO(35) ' make AD(4) an IO
> x = IO(36) ' make AD(5) an IO"
>
>
> I also tried it with this and also using 26,25,30,29,28,27 instead of
11,32,33,34,35,36.
>
> I don't seem to be getting this.
>
> Carl
Hello BasicNode,
It is ArmBASIC Kernel 7.57. It is a USB DIN kit.
Also, all the Digital inputs on the flexible IO's seem to be registering and
changing correctly.
The six AD inputs that I am trying to convert to Digital inputs are all
registering (-1).
I noticed I had stopped receiving the forum on Yahoo.
Thanks
Carl
From: basicnode <bruce@coridium.us>
To: ARMexpress@yahoogroups.com
Sent: Friday, May 10, 2013 5:09 PM
Subject: [ARMexpress] Re: Trouble Changing AD pins to Digital IO
Which version of firmware are you using? Is it USB or Ethernet connected?
Firmware version reported in the Welcome message, which appears when you hit
STOP in BASICtools
brucee
PS, I'm going to move this to the Coridium Forum, Yahoo seems to be trying to
kill off the Groups
www.coridium.us/forum
--- In ARMexpress@yahoogroups.com, "klug.carl" <klug.carl@...> wrote:
>
> I am using a Bourns 4116R LF 101-1 resistor array.
> It is installed in the R15 location with Pin 1 adjacent to the C4 marking on
the board.
> This is how I have it written in my program.
> #include "LPC21xx.bas"
> PINSEL1 AND= &HC003FFFF
> FIO1DIR OR= 1<<16
> FIO1DIR OR= 1<<17 'Open Fr Lat Mot
> FIO1DIR OR= 1<<18 'Close Fr Lat Mot
> FIO1DIR OR= 1<<19 'PM-2 Raise Rear Rail
> FIO1DIR OR= 1<<20 'PM-1 Lower Rear Rail
> FIO1DIR OR= 1<<21 'Valve 1
> FIO1DIR OR= 1<<22 'Valve 2
> FIO1DIR OR= 1<<23 'Valve 3
>
> From ArmBASIC Help
> "D pins are configured as ADs. To return them to IOs, the PINSEL register
needs to be written (details in the NXP LPC2138 User Manual)
>
> PINSEL1 AND= &HC003FFFF ' return ADs to IOs"
>
> Is it also necessary to set the IO up like is says for BASICchip
> 'x = IO(11) ' make AD(0) an IO
> x = IO(32) ' make AD(1) an IO
> x = IO(33) ' make AD(2) an IO
> x = IO(34) ' make AD(3) an IO
> x = IO(35) ' make AD(4) an IO
> x = IO(36) ' make AD(5) an IO"
>
>
> I also tried it with this and also using 26,25,30,29,28,27 instead of
11,32,33,34,35,36.
>
> I don't seem to be getting this.
>
> Carl
Re: BASIC firmware for LPC2138
I did a quick check on a board here
From the prompt I typed @e002c000
e002c000: 00000F05 15540000 00000000 00000000 00000000 00000004 00000000 00000000
To check to see the AD were indeed setup that way, then tried this program-
#include <LPC21xx.bas>
PINSEL1=0
FIO1DIR=&Hffffffff
for i=1 to 100
FIO1SET=&Hffffffff
wait(100)
FIO1CLR=&Hffffffff
wait(100)
print i
next i
That didn't do what I expected, so I checked the PINSEL register again
@e002c000
still showed
e002c000: 00000F05 15540000 00000000 00000000 00000000 00000004 00000000 00000000
So something is wrong here, so I took a look at the definitions in LPC21xx.bas (didn't see it right away). I was looking to see if there was a difference between the LPC2138 and the LPC2103 there, but no...
OK, so I added this to the BASIC program
PRINT hex(PINSEL0), hex(PINSEL1)
and it printed
0 0
Hmm, not the F05, 1554 I expected
So I looked at the output of the pre-processor (that translates #defines into actual values). That file is in %temp%/Coridium/__user.bpp
And I saw --
print hex(PINSEL0), hex(PINSEL1)
Which should really be
print hex(*&HE002C000), hex(*&HE002C004)
So I took a closer look at LPC21xx.bas, and yes there were definitions for PCB_PINSEL0 and PCB_PINSEL1. Which are consistent with NXPs latest User manual, but earlier ones including our help files used PINSEL0 and PINSEL1. So I added these definitions back into the LPC21xx.bas file. That will get into the next release. In the meantime add these lines to that file
#define PINSEL0 *&HE002C000
#define PINSEL1 *&HE002C004
' LPC2138
#define PINSEL2 *&HE002C014
From the prompt I typed @e002c000
e002c000: 00000F05 15540000 00000000 00000000 00000000 00000004 00000000 00000000
To check to see the AD were indeed setup that way, then tried this program-
#include <LPC21xx.bas>
PINSEL1=0
FIO1DIR=&Hffffffff
for i=1 to 100
FIO1SET=&Hffffffff
wait(100)
FIO1CLR=&Hffffffff
wait(100)
print i
next i
That didn't do what I expected, so I checked the PINSEL register again
@e002c000
still showed
e002c000: 00000F05 15540000 00000000 00000000 00000000 00000004 00000000 00000000
So something is wrong here, so I took a look at the definitions in LPC21xx.bas (didn't see it right away). I was looking to see if there was a difference between the LPC2138 and the LPC2103 there, but no...
OK, so I added this to the BASIC program
PRINT hex(PINSEL0), hex(PINSEL1)
and it printed
0 0
Hmm, not the F05, 1554 I expected
So I looked at the output of the pre-processor (that translates #defines into actual values). That file is in %temp%/Coridium/__user.bpp
And I saw --
print hex(PINSEL0), hex(PINSEL1)
Which should really be
print hex(*&HE002C000), hex(*&HE002C004)
So I took a closer look at LPC21xx.bas, and yes there were definitions for PCB_PINSEL0 and PCB_PINSEL1. Which are consistent with NXPs latest User manual, but earlier ones including our help files used PINSEL0 and PINSEL1. So I added these definitions back into the LPC21xx.bas file. That will get into the next release. In the meantime add these lines to that file
#define PINSEL0 *&HE002C000
#define PINSEL1 *&HE002C004
' LPC2138
#define PINSEL2 *&HE002C014
Re: BASIC firmware for LPC2138
PS, the conversion of ADs to IOs has been done for the LPC2103 and LPC175x, we haven't moved that code into the LPC2138, so for now you'll have to do it manually
-
mekkanycol
- Posts: 2
- Joined: Fri May 10, 2013 9:38 pm
Re: BASIC firmware for LPC2138
I just programmed my first DIN Kit with firmware level 7.60.
Flashing a program I have used for firmware 7.57 to check how my inputs were reporting now seems to report different inputs states each time when no inputs have changed. Not sure what is going on.
Also it seems that Comm port 9 is no longer availble but 15 seems to be alive?
#include "LPC21xx.bas"
#define PINSEL0 *&HE002C000
#define PINSEL1 *&HE002C004
#define PINSEL2 *&HE002C014
PINSEL1 AND= &HC003FFFF
FIO1DIR OR= 1<<16
FIO1DIR OR= 1<<17 'Open Fr Lat Mot
FIO1DIR OR= 1<<18 'Close Fr Lat Mot
FIO1DIR OR= 1<<19 'PM-2 Raise Rear Rail
FIO1DIR OR= 1<<20 'PM-1 Lower Rear Rail
FIO1DIR OR= 1<<21 'Valve 1
FIO1DIR OR= 1<<22 'Valve 2
FIO1DIR OR= 1<<23 'Valve 3
r = IO(26) ' make AD(5) an IO
s = IO(25) ' make AD(4) an IO
t = IO(30) ' make AD(3) an IO
x = IO(29) ' make AD(2) an IO
y = IO(28) ' make AD(1) an IO
z = IO(27) ' make AD(0) an IO
Begin:
Input(17)'Close Control Sw
Input(18)'Open Control Sw
Input(10)'Sensor Fr Lat Closed
Input(12)'Sensor Fr Lat Open
Input(13)'Sensor RR Rail Raised
Input(19)'Sensor RR Rail Lowered
Input(20)'Receiver RH Latched
Input(22)'Receiver LH Latched
Input(26)'Sensor Tonn Closed LH
Input(25)'Sensor Tonn Closed RH
Input(30)'Sensor Tonn Opened LH
Input(29)'Sensor Ten Bow Lowered LH
Input(28)'Sensor Ten Bow Lowered RH
Input(27)'Sensor Ten Bow Raised
While 1
c=P0(10)
Print"Front Latch Closed"
Print c
d=P0(12)
PRint "Front Latch Open"
Print d
e=P0(13)
Print"Rear Rail Raised"
Print e
f=P0(19)
Print "Rear Rail Lowered"
Print f
a=P0(17)
PRint"Close Control Switch"
Print a
b=P0(18)
Print"Open Control Switch"
Print b
g=P0(20)
Print"Receiver RH"
Print g
h=P0(22)
Print"Receiver LH"
Print h
r=P0(26)
Print "Tonn Closed LH"
Print r
s=P0(25)
Print "Tonn Closed RH"
Print s
t=P0(30)
Print "Tonn Opened LH"
Print t
x=P0(29)
Print"Ten Bow Lowered LH"
Print x
y=P0(28)
Print "Ten Bow Lowered RH"
Print y
z=P0(27)
Print "Ten Bow Raised"
Print z
Wait(30000)
Loop
Flashing a program I have used for firmware 7.57 to check how my inputs were reporting now seems to report different inputs states each time when no inputs have changed. Not sure what is going on.
Also it seems that Comm port 9 is no longer availble but 15 seems to be alive?
#include "LPC21xx.bas"
#define PINSEL0 *&HE002C000
#define PINSEL1 *&HE002C004
#define PINSEL2 *&HE002C014
PINSEL1 AND= &HC003FFFF
FIO1DIR OR= 1<<16
FIO1DIR OR= 1<<17 'Open Fr Lat Mot
FIO1DIR OR= 1<<18 'Close Fr Lat Mot
FIO1DIR OR= 1<<19 'PM-2 Raise Rear Rail
FIO1DIR OR= 1<<20 'PM-1 Lower Rear Rail
FIO1DIR OR= 1<<21 'Valve 1
FIO1DIR OR= 1<<22 'Valve 2
FIO1DIR OR= 1<<23 'Valve 3
r = IO(26) ' make AD(5) an IO
s = IO(25) ' make AD(4) an IO
t = IO(30) ' make AD(3) an IO
x = IO(29) ' make AD(2) an IO
y = IO(28) ' make AD(1) an IO
z = IO(27) ' make AD(0) an IO
Begin:
Input(17)'Close Control Sw
Input(18)'Open Control Sw
Input(10)'Sensor Fr Lat Closed
Input(12)'Sensor Fr Lat Open
Input(13)'Sensor RR Rail Raised
Input(19)'Sensor RR Rail Lowered
Input(20)'Receiver RH Latched
Input(22)'Receiver LH Latched
Input(26)'Sensor Tonn Closed LH
Input(25)'Sensor Tonn Closed RH
Input(30)'Sensor Tonn Opened LH
Input(29)'Sensor Ten Bow Lowered LH
Input(28)'Sensor Ten Bow Lowered RH
Input(27)'Sensor Ten Bow Raised
While 1
c=P0(10)
Print"Front Latch Closed"
Print c
d=P0(12)
PRint "Front Latch Open"
Print d
e=P0(13)
Print"Rear Rail Raised"
Print e
f=P0(19)
Print "Rear Rail Lowered"
Print f
a=P0(17)
PRint"Close Control Switch"
Print a
b=P0(18)
Print"Open Control Switch"
Print b
g=P0(20)
Print"Receiver RH"
Print g
h=P0(22)
Print"Receiver LH"
Print h
r=P0(26)
Print "Tonn Closed LH"
Print r
s=P0(25)
Print "Tonn Closed RH"
Print s
t=P0(30)
Print "Tonn Opened LH"
Print t
x=P0(29)
Print"Ten Bow Lowered LH"
Print x
y=P0(28)
Print "Ten Bow Lowered RH"
Print y
z=P0(27)
Print "Ten Bow Raised"
Print z
Wait(30000)
Loop
-
mekkanycol
- Posts: 2
- Joined: Fri May 10, 2013 9:38 pm
Re: Problems with BASIC firmware 7.57 and 7.60 for LPC2138
For Firmware 7.50, This pin set up worked for inputs and outputs.
#include "LPC21xx.bas"
FIO1DIR OR= 1<<16
FIO1DIR OR= 1<<17
FIO1DIR OR= 1<<18
FIO1DIR OR= 1<<19
FIO1DIR OR= 1<<20
FIO1DIR OR= 1<<21
FIO1DIR OR= 1<<22
FIO1DIR OR= 1<<23
Begin:
Input(17)'Close Control Sw
Input(18)'Open Control Sw
Input(10)'Sensor Fr Lat Closed
Input(12)'Sensor Fr Lat Open
Input(13)'Sensor RR Rail Raised
Input(19)'Sensor RR Rail Lowered
Input(20)'Receiver RH Latched
Input(22)'Receiver LH Latched
Starting with Firmware 7.57, I can’t get the outputs to behave. For the most part they are on except for 2 pins as soon as I load the program.
If it wasn't obvious I am attempting to control the High Current Outputs.
Here I started using the AD inputs as Digital Inputs.This pin set up was working o.k. for Inputs on firmware 7.57 however, when I loaded it into firmware 7.60, inputs states seem to change at random each time I run my input reporting program with no physical or electrical difference in the input.
#include "LPC21xx.bas"
#define PINSEL0 *&HE002C000
#define PINSEL1 *&HE002C004
#define PINSEL2 *&HE002C014
PINSEL1 AND= &HC003FFFF
FIO1DIR OR= 1<<16
FIO1DIR OR= 1<<17 'Open Fr Lat Mot
FIO1DIR OR= 1<<18 'Close Fr Lat Mot
FIO1DIR OR= 1<<19 'PM-2 Raise Rear Rail
FIO1DIR OR= 1<<20 'PM-1 Lower Rear Rail
FIO1DIR OR= 1<<21 'Valve 1
FIO1DIR OR= 1<<22 'Valve 2
FIO1DIR OR= 1<<23 'Valve 3
r = IO(26) ' make AD(5) an IO
s = IO(25) ' make AD(4) an IO
t = IO(30) ' make AD(3) an IO
x = IO(29) ' make AD(2) an IO
y = IO(28) ' make AD(1) an IO
z = IO(27) ' make AD(0) an IO
Begin:
Input(17)'Close Control Sw
Input(18)'Open Control Sw
Input(10)'Sensor Fr Lat Closed
Input(12)'Sensor Fr Lat Open
Input(13)'Sensor RR Rail Raised
Input(19)'Sensor RR Rail Lowered
Input(20)'Receiver RH Latched
Input(22)'Receiver LH Latched
Input(26)'Sensor Tonn Closed LH
Input(25)'Sensor Tonn Closed RH
Input(30)'Sensor Tonn Opened LH
Input(29)'Sensor Ten Bow Lowered LH
Input(28)'Sensor Ten Bow Lowered RH
Input(27)'Sensor Ten Bow Raised
While 1
c=P0(10)
Print"Front Latch Closed"
Print c
…….
Loop
Not sure if the change in firmware is the issue with my pin set up but I do not know what else it could be presenty. I do not have access to my DIN Kit with firmware 7.50 to test. Not sure if there was published information I missed.
#include "LPC21xx.bas"
FIO1DIR OR= 1<<16
FIO1DIR OR= 1<<17
FIO1DIR OR= 1<<18
FIO1DIR OR= 1<<19
FIO1DIR OR= 1<<20
FIO1DIR OR= 1<<21
FIO1DIR OR= 1<<22
FIO1DIR OR= 1<<23
Begin:
Input(17)'Close Control Sw
Input(18)'Open Control Sw
Input(10)'Sensor Fr Lat Closed
Input(12)'Sensor Fr Lat Open
Input(13)'Sensor RR Rail Raised
Input(19)'Sensor RR Rail Lowered
Input(20)'Receiver RH Latched
Input(22)'Receiver LH Latched
Starting with Firmware 7.57, I can’t get the outputs to behave. For the most part they are on except for 2 pins as soon as I load the program.
If it wasn't obvious I am attempting to control the High Current Outputs.
Here I started using the AD inputs as Digital Inputs.This pin set up was working o.k. for Inputs on firmware 7.57 however, when I loaded it into firmware 7.60, inputs states seem to change at random each time I run my input reporting program with no physical or electrical difference in the input.
#include "LPC21xx.bas"
#define PINSEL0 *&HE002C000
#define PINSEL1 *&HE002C004
#define PINSEL2 *&HE002C014
PINSEL1 AND= &HC003FFFF
FIO1DIR OR= 1<<16
FIO1DIR OR= 1<<17 'Open Fr Lat Mot
FIO1DIR OR= 1<<18 'Close Fr Lat Mot
FIO1DIR OR= 1<<19 'PM-2 Raise Rear Rail
FIO1DIR OR= 1<<20 'PM-1 Lower Rear Rail
FIO1DIR OR= 1<<21 'Valve 1
FIO1DIR OR= 1<<22 'Valve 2
FIO1DIR OR= 1<<23 'Valve 3
r = IO(26) ' make AD(5) an IO
s = IO(25) ' make AD(4) an IO
t = IO(30) ' make AD(3) an IO
x = IO(29) ' make AD(2) an IO
y = IO(28) ' make AD(1) an IO
z = IO(27) ' make AD(0) an IO
Begin:
Input(17)'Close Control Sw
Input(18)'Open Control Sw
Input(10)'Sensor Fr Lat Closed
Input(12)'Sensor Fr Lat Open
Input(13)'Sensor RR Rail Raised
Input(19)'Sensor RR Rail Lowered
Input(20)'Receiver RH Latched
Input(22)'Receiver LH Latched
Input(26)'Sensor Tonn Closed LH
Input(25)'Sensor Tonn Closed RH
Input(30)'Sensor Tonn Opened LH
Input(29)'Sensor Ten Bow Lowered LH
Input(28)'Sensor Ten Bow Lowered RH
Input(27)'Sensor Ten Bow Raised
While 1
c=P0(10)
Print"Front Latch Closed"
Print c
…….
Loop
Not sure if the change in firmware is the issue with my pin set up but I do not know what else it could be presenty. I do not have access to my DIN Kit with firmware 7.50 to test. Not sure if there was published information I missed.
Re: BASIC firmware for LPC2138
We found an issue with the port 1 initialization in firmware 7.60 as well as the setup for TIMER
These have been corrected by version 7.70
These have been corrected by version 7.70
- Attachments
-
- DIN0770.hex
- (42.28 KiB) Downloaded 1139 times