Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include file refactor #33

Closed
wants to merge 76 commits into from
Closed
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
3bc641d
remove IHRC0 and make 0 based start default in firmware
Jun 29, 2020
9b41a22
rework ic calibration to always init PADIER and to have generic calib…
Jun 29, 2020
bd52a53
Merge branch 'development' into feature/newcalibration
Jun 29, 2020
16e6b32
increase calibration measurement length for high IHRC values to incre…
Jun 29, 2020
46bb66e
Initial include file refactor
serisman Jun 29, 2020
c9b96cd
fix some defines
serisman Jun 29, 2020
be1995d
Move __sfr definition out of device specific include files
serisman Jun 30, 2020
68690b9
Merge branch 'development' into feature/device-includes
serisman Jun 30, 2020
056a06f
Merge remote-tracking branch 'upstream/feature/newcalibration' into f…
serisman Jun 30, 2020
1424281
Move util.h back to pdk/
serisman Jun 30, 2020
a9554f3
Move util.h back to pdk/
serisman Jun 30, 2020
cf96ca9
consistent spacing for ILRC_FREQ
serisman Jun 30, 2020
cc9d6d4
new claibration code for 13 and 15 bit
Jun 30, 2020
027a69a
Merge branch 'development' into feature/device-includes
serisman Jun 30, 2020
340f342
Merge branch 'development' into feature/newcalibration
serisman Jun 30, 2020
aaddf83
Refactor/Simplify Factory Calibration and FUSE configuration
serisman Jun 30, 2020
10993a4
Merge remote-tracking branch 'upstream/feature/newcalibration' into f…
serisman Jun 30, 2020
64f38e0
Tweaks for FUSE and Factory Calibration ADDR
serisman Jun 30, 2020
1f18827
Rename __set0/1 macro parameter
serisman Jul 1, 2020
d5e8539
Rename _ASMx macros
serisman Jul 1, 2020
291e491
fix _DATA macro
serisman Jul 1, 2020
a04b589
Stop using relative path for SDCC, add 'make release' target
serisman Jul 1, 2020
ac6a00b
Add .gitignore
serisman Jul 1, 2020
e4d13b3
Rename _STR_DATA to just _STR (too verbose)
serisman Jul 1, 2020
1e7ed58
Add PDK_SET_SYSCLOCK macro and definitions, add support for EOSC, and…
serisman Jul 1, 2020
258a71c
move erase and blankcheck after loading and checking file to write
Jul 1, 2020
d97725a
add detection of unsupported calibration patterns and abort programing
Jul 1, 2020
063ab2d
Start work on ensuring proper BIT / MASK values (PFS154 only so far)
serisman Jul 1, 2020
08fd9ee
GPCS BIT/MASK (for PFS154)
serisman Jul 1, 2020
d67ec56
Merge remote-tracking branch 'upstream/feature/newcalibration' into f…
serisman Jul 1, 2020
23f7d8e
Merge branch 'feature/newcalibration' into feature/device-includes
serisman Jul 1, 2020
2f0afdb
Update register descriptions
serisman Jul 1, 2020
522388b
Finish defining register BIT/MASK values (PFS154)
serisman Jul 1, 2020
75308ea
Remove unnecessary PADIE/PBDIE definitions
serisman Jul 1, 2020
196650d
fix order
serisman Jul 1, 2020
729c0b6
Move common peripherals to separate includes and convert more devices.
serisman Jul 2, 2020
7c89a77
Finish common periph changes and convert PFS172
serisman Jul 2, 2020
4ac9bfd
Cleanup some MISC2/MISCLVR periph stuff
serisman Jul 2, 2020
4136e28
Add support for PMS152
serisman Jul 2, 2020
76d9aef
Add support for PMS152
serisman Jul 2, 2020
258cc7b
Add support for PMS171B and bug fixes
serisman Jul 2, 2020
8bd589b
Re-organize directory structure an cleanup headers
serisman Jul 2, 2020
4b43f19
use #if defined(...) instead of #ifdef ...
serisman Jul 2, 2020
3f98af8
Move __sfr defs into periph files and remove sfr_defs.h
serisman Jul 2, 2020
33b789d
Rename pdk/io.h to pdk/device.h
serisman Jul 2, 2020
ad7391f
Update prebuild hex files
serisman Jul 2, 2020
80dfa70
Update README.md
serisman Jul 2, 2020
1b81097
Organize Examples a bit
serisman Jul 2, 2020
657624a
formatting
serisman Jul 2, 2020
1f98517
Re-order devices
serisman Jul 2, 2020
6af3265
More Makefile cleanup
serisman Jul 2, 2020
36814ed
Fix calibration code
serisman Jul 2, 2020
5963491
Fix clmode[3]=1
serisman Jul 2, 2020
87cf1ee
Optimize adctest.c so it can be used on smaller devices
serisman Jul 2, 2020
26e6c19
Optimize adctest.c so it can be used on smaller devices
serisman Jul 2, 2020
26e4be2
Minor tweaks to examples
serisman Jul 2, 2020
fe84475
More bug fixes
serisman Jul 2, 2020
6ab86de
Add 250KHZ IHRC option, and fix some typos
serisman Jul 2, 2020
804f7a5
Add pre-compiled hex files for calib-and-fuse-demo.ihx
serisman Jul 2, 2020
ead79ce
Merge in development
serisman Jul 2, 2020
ceeffc9
typo
serisman Jul 2, 2020
23baf06
Formatting
serisman Jul 2, 2020
acaab8f
typo
serisman Jul 2, 2020
449c474
Add __reset() macro
serisman Jul 2, 2020
45a7c7f
Add unsupported 16MHz frequency back in
serisman Jul 2, 2020
a9cd40e
Merge branch 'development' into feature/device-includes
serisman Jul 3, 2020
557e12a
fix typo
serisman Jul 4, 2020
e9c6300
Allow pdk/device/xxx.h files to be pulled in directly without going t…
serisman Jul 4, 2020
8404ae8
Merge in development branch
serisman Jul 5, 2020
d77523e
Remove old files from development, and re-compile all examples
serisman Jul 5, 2020
f227ac1
Sync changes from 'pdk-includes' repo
serisman Jul 5, 2020
b982060
Sync changes from 'pdk-includes' repo (Adds support for PMS154B/C, PM…
serisman Jul 6, 2020
80e3002
Sync changes from 'pdk-includes' repo (Adds support for PMS131, and f…
serisman Jul 6, 2020
63b5900
Sync changes from 'pdk-includes' repo (rename HAS_x to __PDK_HAS_x, a…
serisman Jul 7, 2020
e890ecc
Fix typo
serisman Jul 7, 2020
0e1e02d
Merge branch 'development' into feature/device-includes
serisman Jul 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Examples/src/adctest.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <stdint.h>
#include <stdio.h>
#include "easypdk/pdk.h"
#include "pdk/io.h"

volatile uint16_t txdata; //txdata, serial data shift register

Expand Down Expand Up @@ -33,9 +33,9 @@ int putchar(int c)

unsigned char _sdcc_external_startup(void)
{
EASY_PDK_INIT_SYSCLOCK_8MHZ(); //use 8MHz sysclock
EASY_PDK_USE_FACTORY_IHRCR_16MHZ() //use factory IHCR tuning value (tuned for 8MHz SYSCLK @ 5.0V)
EASY_PDK_USE_FACTORY_BGTR(); //use factory BandGap tuning value (tuned @ 5.0V)
PDK_USE_8MHZ_IHRC_SYSCLOCK(); //use 8MHz sysclock
PDK_USE_FACTORY_IHRCR_16MHZ() //use factory IHCR tuning value (tuned for 8MHz SYSCLK @ 5.0V)
PDK_USE_FACTORY_BGTR(); //use factory BandGap tuning value (tuned @ 5.0V)
return 0; //perform normal initialization
}

Expand Down
29 changes: 15 additions & 14 deletions Examples/src/calib-and-fuse-demo.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#include <stdint.h>
#include "easypdk/pdk.h"
#include "pdk/io.h"
#include "easy-pdk/calibrate.h"

unsigned char _sdcc_external_startup(void)
{
//
// F U S E S
//
// Set specific FUSES (defines in IC specific header file, e.g. "easypdk/pfs173.h"), easypdk programmer will set FUSE values after writing
EASY_PDK_FUSE(FUSE_SECURITY_OFF|FUSE_BOOTUP_FAST);
// Set specific FUSES (defines in IC specific header file, e.g. "pdk/io_pfs173.h"), easypdk programmer will set FUSE values after writing
PDK_SET_FUSE(FUSE_SECURITY_OFF|FUSE_BOOTUP_FAST);

//
// C A L I B R A T I O N S
Expand All @@ -17,48 +18,48 @@ unsigned char _sdcc_external_startup(void)
// SYSCLK setup and calibration (Your application should use only one of the IHRC and/or ILRC setup and claibrations).

// setup ILRC as sysclock and let easypdk programmer do the calibration (after writing)
EASY_PDK_INIT_SYSCLOCK_ILRC(); //use ILRC as sysclock, 60-96kHz, depends on IC variant
PDK_USE_ILRC_SYSCLOCK(); //use ILRC as sysclock, 60-96kHz, depends on IC variant
EASY_PDK_CALIBRATE_ILRC(ILRC_FREQ,4000); //tune SYSCLK to 95kHz @ 4.000V (value for PFS173)

// setup ILRC/4 as sysclock and let easypdk programmer do the calibration (after writing)
EASY_PDK_INIT_SYSCLOCK_ILRC_DIV4(); //use ILRC/4 as sysclock, 15-24kHz, depends on IC variant
PDK_USE_ILRC_DIV4_SYSCLOCK(); //use ILRC/4 as sysclock, 15-24kHz, depends on IC variant
EASY_PDK_CALIBRATE_ILRC(ILRC_FREQ/4,3300); //tune SYSCLK to 24kHz @ 3.300V (value for PFS173)

#if defined(CLKMD_ILRC_DIV16)
// setup ILRC/16 as sysclock and let easypdk programmer do the calibration (after writing)
EASY_PDK_INIT_SYSCLOCK_ILRC_DIV16(); //use ILRC/16 as sysclock, 4-6kHz, depends on IC variant
PDK_USE_ILRC_DIV16_SYSCLOCK(); //use ILRC/16 as sysclock, 4-6kHz, depends on IC variant
EASY_PDK_CALIBRATE_ILRC(ILRC_FREQ/16,3000); //tune SYSCLK to 6kHz @ 3.000V (value for PFS173)
#endif

#if defined(PFS154) || defined(PFS172) || defined(PFS173)
// setup 8MHz sysclock and use factory calibration (available on PFS154 and PFS173)
EASY_PDK_INIT_SYSCLOCK_8MHZ(); //use 8MHz sysclock
EASY_PDK_USE_FACTORY_IHRCR_16MHZ(); //use factory calibration value
PDK_USE_8MHZ_IHRC_SYSCLOCK(); //use 8MHz sysclock
PDK_USE_FACTORY_IHRCR_16MHZ(); //use factory calibration value
#endif

// setup 8MHz sysclock and let easypdk programmer do the calibration (after writing)
EASY_PDK_INIT_SYSCLOCK_8MHZ(); //use 8MHz sysclock
PDK_USE_8MHZ_IHRC_SYSCLOCK(); //use 8MHz sysclock
EASY_PDK_CALIBRATE_IHRC(8000000,5000); //tune SYSCLK to 8MHz @ 5.000V

// setup 4MHz sysclock and let easypdk programmer do the calibration (after writing)
EASY_PDK_INIT_SYSCLOCK_4MHZ(); //use 4MHz sysclock
PDK_USE_4MHZ_IHRC_SYSCLOCK(); //use 4MHz sysclock
EASY_PDK_CALIBRATE_IHRC(4000000,4500); //tune SYSCLK to 4MHz @ 4.500V

// setup 2MHz sysclock and let easypdk programmer do the calibration (after writing)
EASY_PDK_INIT_SYSCLOCK_2MHZ(); //use 2MHz sysclock
PDK_USE_2MHZ_IHRC_SYSCLOCK(); //use 2MHz sysclock
EASY_PDK_CALIBRATE_IHRC(2000000,4000); //tune SYSCLK to 4MHz @ 4.000V

// setup 1MHz sysclock and let easypdk programmer do the calibration (after writing)
EASY_PDK_INIT_SYSCLOCK_1MHZ(); //use 1MHz sysclock
PDK_USE_1MHZ_IHRC_SYSCLOCK(); //use 1MHz sysclock
EASY_PDK_CALIBRATE_IHRC(1000000,3300); //tune SYSCLK to 1MHz @ 3.300V

// setup 500kHz sysclock and let easypdk programmer do the calibration (after writing)
EASY_PDK_INIT_SYSCLOCK_500KHZ(); //use 500KHZ sysclock
PDK_USE_500KHZ_IHRC_SYSCLOCK(); //use 500KHZ sysclock
EASY_PDK_CALIBRATE_IHRC(500000,3000); //tune SYSCLK to 500kHz @ 3.000V


// BANDGAP calibration:
EASY_PDK_USE_FACTORY_BGTR(); //use factory BandGap calibration value
PDK_USE_FACTORY_BGTR(); //use factory BandGap calibration value
// -OR-
EASY_PDK_CALIBRATE_BG(); //let easypdk progammer do the bandgap calibration (after writing) - bandgap tuning requires any IHRC SYSCLK

Expand Down
7 changes: 4 additions & 3 deletions Examples/src/comptest.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

#include <stdint.h>
#include <stdio.h>
#include "easypdk/pdk.h"
#include "pdk/io.h"
#include "easy-pdk/calibrate.h"

volatile uint16_t txdata; //txdata, serial data shift register

Expand Down Expand Up @@ -39,9 +40,9 @@ int putchar(int c)

unsigned char _sdcc_external_startup(void)
{
EASY_PDK_INIT_SYSCLOCK_1MHZ(); //use 1MHz sysclock
PDK_USE_1MHZ_IHRC_SYSCLOCK(); //use 1MHz sysclock
EASY_PDK_CALIBRATE_IHRC(1000000,5000); //tune SYSCLK to 1MHz @ 5.000V
EASY_PDK_USE_FACTORY_BGTR(); //use factory BandGap tuning value (tuned @ 5.0V)
PDK_USE_FACTORY_BGTR(); //use factory BandGap tuning value (tuned @ 5.0V)
return 0; //perform normal initialization
}

Expand Down
48 changes: 48 additions & 0 deletions Examples/src/easy-pdk/calibrate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#ifndef __EASY_PDK_CALIBRATE_H__
#define __EASY_PDK_CALIBRATE_H__

#if !defined(__PDK_IO_H__)
# error "You must #include "pdk/io.h" "
#endif

//place holder for EASYPDK calibrations executed / replaced by easypdkprog
#define EASY_PDK_CALIBRATE_IHRC(frequency,millivolt) EASY_PDK_CALIBRATE_RC_M(EASY_PDK_CALTYPE_IHRC, IHRCR_ADDR, frequency, millivolt)
#define EASY_PDK_CALIBRATE_ILRC(frequency,millivolt) EASY_PDK_CALIBRATE_RC_M(EASY_PDK_CALTYPE_ILRC, ILRCR_ADDR, frequency, millivolt)
#define EASY_PDK_CALIBRATE_BG() EASY_PDK_CALIBRATE_BG_M(BGTR_ADDR, GPCC_ADDR, GPCS_ADDR)

#define EASY_PDK_CALTYPE_IHRC 1
#define EASY_PDK_CALTYPE_ILRC 2

#define EASY_PDK_CALIBRATE_RC_M(type,reg,frequency,millivolt) \
__asm__( \
"and a, #'R' \n"\
"and a, #'C' \n"\
"and a, #(("_ASMD(type)")) \n"\
"and a, #(("_ASMD(frequency)")) \n"\
"and a, #(("_ASMD(frequency)")>>8) \n"\
"and a, #(("_ASMD(frequency)")>>16) \n"\
"and a, #(("_ASMD(frequency)")>>24) \n"\
"and a, #(("_ASMD(millivolt)")) \n"\
"and a, #(("_ASMD(millivolt)")>>8) \n"\
"and a, #(("_ASMD(reg)")>>8) \n"\
)

#define EASY_PDK_CALIBRATE_BG_M(bgtr,gpcc,gpcs) \
__asm__( \
"and a, #'B' \n"\
"and a, #'G' \n"\
"and a, #(3) \n"\
"and a, #(3950) \n"\
"and a, #(3950>>8) \n"\
"and a, #(("_ASMD(bgtr)")) \n"\
"and a, #(("_ASMD(gpcc)")) \n"\
"and a, #(("_ASMD(gpcs)")) \n"\
"and a, #0 \n"\
"and a, #0 \n"\
"and a, #0 \n"\
"and a, #0 \n"\
"and a, #0 \n"\
"and a, #0 \n"\
)

#endif //__EASY_PDK_CALIBRATE_H__
7 changes: 7 additions & 0 deletions Examples/src/easy-pdk/serial_num.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef __EASY_PDK_SERIAL_NUM_H__
#define __EASY_PDK_SERIAL_NUM_H__

//place holder for EASYPDK serial inserted from easypdkprog
#define EASY_PDK_SERIAL_NUM(sname) static const uint8_t sname[8] = {'F','P','S','E','R','I','A','L'}

#endif //__EASY_PDK_SERIAL_NUM_H__
16 changes: 0 additions & 16 deletions Examples/src/easypdk/pdk.h

This file was deleted.

196 changes: 0 additions & 196 deletions Examples/src/easypdk/pdkcommon.h

This file was deleted.

Loading