Page 1 of 2

Datalogger Resources

Posted: Sat Jan 24, 2015 2:56 pm
by olzeke51
Feel free to contribute to this ongoing project My intention is to capture/report items related
to the Datalogger -- issues/problems should not be reported here - use the other forums.
I would like to see techniques for the M4/M0 processing, working code snippets for particular hardware,
and other types of documentation.

Re: Datalogger Resources-RTC

Posted: Sat Jan 24, 2015 2:58 pm
by olzeke51
this is my RTC type #defines for the LPC43xx.bas file
okay community ... here is an updated version of LPC43xx.bas [snippet] #defines to match the
variable names used in RTC.bas (I will later make/post my own RTC43.bas file)
'NOTICE there is now a bigger REGFILE section that is VBAT powered
'// ---------------------------------------------------------------------
'// ----- ATIMER
'// ---------------------------------------------------------------------
' * @brief Product name title=UM10430 Chapter title=LPC43xx Alarm timer Modification date=1/7/2011 Major revision=0 Minor revision=6 (ATIMER)
' */

#define DOWNCOUNTER *&H40040000 ' Downcounter register
#define PRESET *&H40040004 ' Preset value register
#define CLR_EN *&H40040FD8 ' Interrupt clear enable register
#define SET_EN *&H40040FDC ' Interrupt set enable register
#define STATUS *&H40040FE0 ' Status register
'??? ALSO on RTC_ALARM chip pin 120
#define ENABLE *&H40040FE4 ' Enable register
#define CLR_STAT *&H40040FE8 ' Clear register
#define SET_STAT *&H40040FEC ' Set register

'// --------------------------------------------------------------------
'// ----- REGFILE
'// --------------------------------------------------------------------
' * @brief Product name title=UM10430 Chapter title=LPC43xx rtc/REGFILE date=1/20/2011 Major revision=0 Minor revision=7 (REGFILE)
' */

'typedef struct '{ < (* &H40041000) REGFILE Structure ' */
'__IO uint32_t REGFILE[64] '/* General purpose storage register */
' THESE are available in the RTC power domain (VBAT) '//olzeke51
#define REGFILE_BASE_ADDR &H40041000

// ----------------------------------------------------------------------
'// ----- CREG
'// ---------------------------------------------------------------------
' * @brief Product name title=UM10430 Chapter title=LPC43xx Configuration Registers (CREG) Modification date=1/20/2011 Major revision=0 Minor revision=7 (CREG)
' modified Jan 23,2015 by Olzeke51 for use the RTC43.bas file
' */

#define IRCTRM *&H40043000 ' IRC trim register
#define CREG0 *&H40043004 'Chip configuration register 32 kHz
'oscillator output and BOD control register.
#define PMUCON *&H40043008 'Power mode control register.
#define M4MEMMAP *&H40043100 'ARM Cortex-M4 memory mapping
#define CREG5 *&H40043118 'Chip configuration register 5.
'Controls JTAG access.
#define DMAMUX *&H4004311C 'DMA muxing control
#define ETBCFG *&H40043128 'ETB RAM configuration
#define CREG6 *&H4004312C 'tbd.
#define CHIPID *&H40043200 'Part ID #

'// ---------------------------------------------------------------------
'// ----- RTC
'// ---------------------------------------------------------------------
' * @brief Product name title=UM10430 Chapter title=LPC43xx Real-Time Clock (RTC) Modification date=1/20/2011 Major revision=0 Minor revision=7 (RTC)

' #defines USED by Coridium ARMBasic
#define RTC_BASE_ADDR &H40046000
#define RTC_ILR *(RTC_BASE_ADDR + &H00)
'reserved *(RTC_BASE_ADDR + &H04)
#define RTC_CCR *(RTC_BASE_ADDR + &H08)
#define RTC_CIIR *(RTC_BASE_ADDR + &H0C)
#define RTC_AMR *(RTC_BASE_ADDR + &H10)
#define RTC_CTIME0 *(RTC_BASE_ADDR + &H14)
#define RTC_CTIME1 *(RTC_BASE_ADDR + &H18)
#define RTC_CTIME2 *(RTC_BASE_ADDR + &H1C)
#define RTC_SEC *(RTC_BASE_ADDR + &H20)
#define RTC_MIN *(RTC_BASE_ADDR + &H24)
#define RTC_HOUR *(RTC_BASE_ADDR + &H28)
#define RTC_DOM *(RTC_BASE_ADDR + &H2C)
#define RTC_DAY *(RTC_BASE_ADDR + &H2C) ' //aka
#define RTC_DOW *(RTC_BASE_ADDR + &H30)
#define RTC_DOY *(RTC_BASE_ADDR + &H34)
#define RTC_MONTH *(RTC_BASE_ADDR + &H38)
#define RTC_YEAR *(RTC_BASE_ADDR + &H3C)
#define RTC_CAL *(RTC_BASE_ADDR + &H40) '//changed

#define RTC_ALSEC *(RTC_BASE_ADDR + &H60)
#define RTC_ALMIN *(RTC_BASE_ADDR + &H64)
#define RTC_ALHOUR *(RTC_BASE_ADDR + &H68)
#define RTC_ALDOW *(RTC_BASE_ADDR + &H70)
#define RTC_ALDOY *(RTC_BASE_ADDR + &H74)
#define RTC_ALMON *(RTC_BASE_ADDR + &H78)

Re: Datalogger Resources -Arduino pinouts

Posted: Sat Jan 24, 2015 3:20 pm
by olzeke51
here are some worksheets for the Arduino connectors (and the additional analog connector)
not sure what format to post in, I like the pdf but it can't be changed to add project notes. [which was my main goal]
here is a Google Docs link with comment permissions for the 'analog' connections ... sp=sharing
**analog connections were updated
now for the 'data' connectors ... sp=sharing

any suggestions??
NOTICE how if you 'Post a Reply' it brings up just the main "Datalogger Resources" label
You can then add the "- topic" to the end of it. This might help in the future when you are looking for a
particular bit of info !!!
Have Fun !! [ you can tell I'm a DIYer, but a wannabe engineer]

Re: Datalogger Resources - AD inputs

Posted: Sat Jan 24, 2015 4:08 pm
by olzeke51
currently AD inputs 9 & 11 aren't good to use
due to NXPs design - you should restrict your AD inputs to 0 through 7 on the Datalogger
here is what I did
checked all the AD(x) channels with a pot to 3.3v arduino pin and arduino gnd
two failed - AD(11) and AD(9) - they sort of followed the input,
wouldn't hold too steady - couldn't min or max (only 950 to 270 or so)
other channels did good 0 to 1023 [with the bit shift function]
*** program snippet
voltage = AD(channel)
print ( voltage >> 6)
the UM says it takes 2.45us for a conversion (non-burst mode)
so your program will have a pause in it for this length of time at a minimum

Re: Datalogger Resources - RTC

Posted: Mon Jan 26, 2015 3:06 pm
by olzeke51
here is some initialization code for the RTC ; add it/incorporate it into your
RTC.bas file as needed -- you do need the external crystal/caps/battery installed.
' Hardware Interface -- real time clock functions
' INITIALIZATION CODE added to turn on & enable the RTC domain & clock -25 Jan 2015 olzeke51
' copyright Coridium Corp, 2008, may be used with Coridium Hardware or licensees
'/* modified by Olzeke51 for Coridium Datalogger [LPC4330] Jan 21,2015

#ifndef USE_timing 'Coridium original
#define USE_timing 'Coridium original

#ifdef LPC4330
#include <LPC43xx.bas>
#error program is made for the LPC4330 series
SUB rtc_init

CREG0 = &H3FC3 'turns on power and oscillators - 1khz & 32Khz
'bits 7&6 ; bits 13&12 set to 0x03 to save battery current - errata sheet 25Jan2013
' event router not being used - as no low power modes used

RTC_CCR = &H0001 'enables the RTC registers
RTC_AMR = &HFF 'turns off alarm because all 1's
'the ATIMER (alarm timer) section indicated this was needed
'IF I didn't implement or set up the interrupt/event router routines
WAIT(2000) 'lets the registers start counting
' check to see if alarm_timer /1HZ clock is runnning
'used primarily for debugging - watch the STOP command !!!
'PRESET = 4000 ' so the DOWNCOUNTER has something to work with
'dim start, finish
'IF start = finish
' print "downcounter not working in Alarm/RTCTimer"


Re: Datalogger Resources

Posted: Fri Jan 30, 2015 2:42 pm
by basicchip
A user reminded me that the schematic for the DATAlogger was not on the website or in the installer. The installer will get fixed next revision. In the meantime here is the schematic for the DATAlogger.
(74.54 KiB) Downloaded 613 times

Re: Datalogger Resources - program sizes - updated

Posted: Mon Feb 09, 2015 4:46 am
by olzeke51
8.35b kernel // ARMbasic[9.35a] // BASICtools [5.40]
reports these programming limits when doing manual(line by line input)
Programming Flash 4330... the M4
ARMbasic[9.35a] on the PC Copyright 2015, Coridium Corp.
... ( 0.06K code + 0.00K const)/64K 4.01/16K data programmed part of the q-spifi
M4 Executing...
Programming Flash 4330... the M0
quick exit for M4 code*+
switch to M0 Flash start
ARMbasic[9.35a] on the PC Copyright 2015, Coridium Corp.
*+*+ ......................................................................part of the q-spifi
... ( 0.02K code + 0.00K const)/48K 0.00/2K data programmed ONLY approx 2K of DATA
*************** update Feb 17, 2015
I assume the ' data programmed section' is basically 32bit integers with a mix of string/bytes
and the 'code / constants' is basically 16 bit {Thumb2 instructions} & string/bytes
**there is also space taken up by the ARMbasic runtime program
there is a shared 16kB at 0x2000 C000 -- this is onchip SRAM
don't forget that there is the microSD card available- for DATA
CAUTION: not sure what your SD card uses for file block size for writing
assuming a FAT format - at one time the ROOT directory could only hold (reliably)
224 entries[??FAT12. The ARMbasic doesn't support sub-directories AFAIK.

Re: Datalogger Resources

Posted: Sat Mar 26, 2016 9:57 pm
by olzeke51
when the 'datalogger' was designed - did you have any particular concept/hardware of
connecting to all those IO pins?
TIA, Olzeke51

Re: Datalogger Resources

Posted: Sat Mar 26, 2016 10:53 pm
by basicchip
Nothing special, just 0.1" headers easy to wire to.

Re: Datalogger Resources -Arduino pinouts

Posted: Tue Apr 28, 2020 2:27 am
by TodWulff
olzeke51 wrote:
Sat Jan 24, 2015 3:20 pm
here are some worksheets for the Arduino connectors (and the additional analog connector)...olzeke51
This thread presents to be about the 4330 datalogger, but your make references herein about the Arduino Datalogger. Is that for informational purposes only, to help with pin translations?