.rom
wdreset
mov a,#ffh
mov pbc,a
mov a,clkmd
mov pb,a
label1:
wdreset
nop
nop
nop
goto label1
I wrote a very simple code again, after reset I put the clkmd register value to port B.Code: [Select].rom
wdreset
mov a,#ffh
mov pbc,a
mov a,clkmd
mov pb,a
label1:
wdreset
nop
nop
nop
goto label1
According to PFS154 datasheet clkmd value after reset should be: 0xF6
I read 0x9E
This means clock select type is 1, and clock mode is IHRC/64 = so 16MHz / 64 = 250kHz
If one instruction is executed in 2 cycles, and I did not calibrated the IHRC, that could answer the question why my PFS154 running at 143kHz
It's very annoying if we can not trust in the data sheet.
Also anyone know how PADAUK see that whole open-source toolchain ? They gonna try support/kill it or maybe do nothing about it ?
What kind of video demo? A video from my hackintosh (intel NUC) starting up?
Also anyone know how PADAUK see that whole open-source toolchain ? They gonna try support/kill it or maybe do nothing about it ?
./easypdkprog -v probe
Searching programmer... found: /dev/ttyACM3
FREE-PDK EASY PROG - Hardware:1.2 Firmware:1.2 Protocol:1.2
Probing IC... found.
TYPE:FLASH RSP:0xAA1 VPP=4.50 VDD=2.00
IC is supported: PFS154 ICID:0xAA1
/Bingo
But I did not find info how security (MTP code protection), boot-up time, drive (IO low/normal driving) works, so the rest of Code Options chapter is unclear for me.
misc.5 controls the wake-up time but I am not sure it is the same thing what mentioned in Code Options chapter.
Just made one of Tim's lite programmers.
My first STM32 SMD soldering job, have only tried AVR SMD before
Tim sent me two , and i totally screwed up the first one ... Tacked down 2 sides but began drag soldering on the tacked side
MCU badly misaligned , and when trying to correct i badly bent 4 pins.
Well the 2'nd went ok i think , i can DFU program it w. the programer sw.
Now off to solder a PADA to a SMD-DIP board.
Just made one of Tim's lite programmers.
My first STM32 SMD soldering job, have only tried AVR SMD before
Tim sent me two , and i totally screwed up the first one ... Tacked down 2 sides but began drag soldering on the tacked side
MCU badly misaligned , and when trying to correct i badly bent 4 pins.
Well the 2'nd went ok i think , i can DFU program it w. the programer sw.
Now off to solder a PADA to a SMD-DIP board.
Buy yourself good flux (paste/gel), it's unbelievable what difference it can make, it's magic. I build 2 original programmers and i was struggling with first one, for 2nd i used better flux and it was smooth, soldered tqfp48 without using copper wick , joints nicely shine. Now i have programmer for stable and dev easy-pdk branch.
But I did not find info how security (MTP code protection), boot-up time, drive (IO low/normal driving) works, so the rest of Code Options chapter is unclear for me.
misc.5 controls the wake-up time but I am not sure it is the same thing what mentioned in Code Options chapter.
Assumption (DS) IHRC = 16MHz
SysClock = IHRC/16
Timer16 irq (bit8) - every 512 cycles
ticks every 16000000/512 = 31250 clock cycles should be ~32uS
I'm toggling PB3 in the timer ISR , just to be able to put a scope on
Scope - PB3 toggle
Tick IHRC = 58,4uS
Tick sysclock = 888uS
483 ; main.c: 64: AUTO_INIT_SYSCLOCK();
484 ; genAssign
00010A 1C 2F 485 mov a, #0x1c
00010C 83 01 486 mov __clkmd, a
000000 232 _millis_setup:
233 ; ../include/millis.h: 29: T16M = (uint8_t)(T16M_CLK_IHRC | T16M_CLK_DIV1 | T16M_INTSRC_8BIT);
234 ; genAssign
000000 80 2F 235 mov a, #0x80
000002 86 01 236 mov __t16m, a
478 ; -----------------------------------------
479 ; function _sdcc_external_startup
480 ; -----------------------------------------
481 ; Register assignment is optimal.
00010A 482 __sdcc_external_startup:
483 ; main.c: 65: AUTO_INIT_SYSCLOCK();
484 ; genAssign
00010A 1C 2F 485 mov a, #0x1c
00010C 83 01 486 mov __clkmd, a
487 ; main.c: 70: AUTO_CALIBRATE_SYSCLOCK(TARGET_VDD_MV);
488 ; genInline
00010E 52 2C 489 and a, #'R'
000110 43 2C 490 and a, #'C'
000112 01 2C 491 and a, #(1)
000114 40 2C 492 and a, #((1000000))
000116 42 2C 493 and a, #((1000000)>>8)
000118 0F 2C 494 and a, #((1000000)>>16)
00011A 00 2C 495 and a, #((1000000)>>24)
00011C A0 2C 496 and a, #((4000))
00011E 0F 2C 497 and a, #((4000)>>8)
000120 0B 2C 498 and a, #(0x0b)
499 ; main.c: 82: return 0; // Return 0 to inform SDCC to continue with normal initialization.
500 ; genReturn
501 ; genLabel
502 ; peephole j0 removed unused label 00101$.
503 ; main.c: 83: }
504 ; genEndFunction
000122 00 02 505 ret #0x00
What does this
487 ; main.c: 70: AUTO_CALIBRATE_SYSCLOCK(TARGET_VDD_MV);
And forward do ??
(...)
It does a lot of magic w. accumulator a , but never saves it anywhere - It just does that stuff , and then returns 0x00 in a.
easypdkprog -V
easypdkprog 1.2
$ dfu-util -d 0483:df11 -a "@Internal Flash /0x08000000/064*0002Kg" --dfuse-address 0x08000000 -D EASYPDKPROG.bin
$ dfu-util -d 0483:df11 -a "@Internal Flash /0x08000000/064*0002Kg" --dfuse-address 0x08000000 -D EASYPDKPROG.dfu
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash "
Downloading to address = 0x08000000, size = 29068
Download [=========================] 100% 29068 bytes
Download done.
File downloaded successfully
The data sheet is also right... Usually PADAUK initializes the default values inside of the startup code they insert when you use the PADAUK IDE.
Since you use your own assembler / compiler you have to re-create the startup code and initializations.
BTW: PADAUK startup code wastes up to 10% of the valuable code memory.
Anyway, a good practice is to always set the complete value yourself.
JS
which programmer version you use ? (firmware and software)What does this
487 ; main.c: 70: AUTO_CALIBRATE_SYSCLOCK(TARGET_VDD_MV);
And forward do ??
(...)
It does a lot of magic w. accumulator a , but never saves it anywhere - It just does that stuff , and then returns 0x00 in a.
It is placeholder for programmer. Before flashing, it search for that code, reads desired MHz, and voltage, and replace that code with calibration routine. After flashing programmer use that routine to calibrate clock (by measuring pin change frequency, and switching pin), after that, calibration value is written and most of calibration routine is overwritten with nop (with OTP you can clear bit but can't set bit)
I'll give the DFU version a go
It's this one correct ?
https://github.com/free-pdk/easy-pdk-programmer-software/tree/development/Firmware
git clone https://github.com/free-pdk/easy-pdk-programmer-software.git
...
Did program the programmer w. the dfuCode: [Select]$ dfu-util -d 0483:df11 -a "@Internal Flash /0x08000000/064*0002Kg" --dfuse-address 0x08000000 -D EASYPDKPROG.dfu
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash "
Downloading to address = 0x08000000, size = 29068
Download [=========================] 100% 29068 bytes
Download done.
File downloaded successfully
Still getting 2 sec between blinks.
...
I have just resoldered the SPI side of the Programmer MCU , all looks ok.
Still 2 Sec intervals
easypdkprog -n PFS154 write .output/BlinkLED_WithIRQ_PFS154.ihx
Erasing IC... done.
Writing IC (170 words)... done.
Calibrating IC
* IHRC SYSCLK=1000000Hz @ 4.00V ... calibration result: 997283Hz (0x84) done.
bingo600, it definitely sounds like you are not getting a successful calibration, and that is most likely why the timing is off.
As kaweksl has already indicated, this is most likely because the free-pdk-examples currently require the 'development' branch of the easy-pdk-programmer-software for successful calibration. The calibration routines were changed compared to the previously released version (i.e. master).
You seem to have found the correct development branch, but it is unclear if you have actually re-complied the firmware and software. Both are needed. You can't just use the .dfu firmware from the development branch, as it hasn't been updated yet. And, the easypdkprog software needs to be re-compiled as well. You can't just use the previous 1.2 release.
When using the re-compiled .dfu firmware and the re-compiled easypdkprog you should get output like this (after running make program):Code: [Select]easypdkprog -n PFS154 write .output/BlinkLED_WithIRQ_PFS154.ihx
Erasing IC... done.
Writing IC (170 words)... done.
Calibrating IC
* IHRC SYSCLK=1000000Hz @ 4.00V ... calibration result: 997283Hz (0x84) done.
If you are not seeing those last two lines, something is off, and the IC is not properly calibrated.
If it still isn't working after making sure you are using re-compiled firmware and software, can you post the results of running make program so we can troubleshoot further?
git pull
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 5 (delta 2), reused 5 (delta 2), pack-reused 0
Unpacking objects: 100% (5/5), done.
From https://github.com/free-pdk/easy-pdk-programmer-software
3a557cc..78983e5 master -> origin/master
be5ea01..78983e5 development -> origin/development
* [new tag] 1.3 -> 1.3
Updating 3a557cc..78983e5
Checking out files: 100% (153/153), done.
arm-none-eabi-size build/EASYPDKPROG.elf
text data bss dec hex filename
33176 488 13088 46752 b6a0 build/EASYPDKPROG.elf
arm-none-eabi-objcopy -O binary -S build/EASYPDKPROG.elf build/EASYPDKPROG.bin
cp build/EASYPDKPROG.bin build/EASYPDKPROG.dfu
dfu-suffix -v 0483 -p df11 -a build/EASYPDKPROG.dfu
dfu-suffix (dfu-util) 0.9
Copyright 2011-2012 Stefan Schmidt, 2013-2014 Tormod Volden
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Suffix successfully added to file
$ dfu-util -d 0483:df11 -a "@Internal Flash /0x08000000/064*0002Kg" --dfuse-address 0x08000000 -D EASYPDKPROG.dfudfu-util -d 0483:df11 -a "@Internal Flash /0x08000000/064*0002Kg" --dfuse-address 0x08000000 -D EASYPDKPROG.dfu
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash "
Downloading to address = 0x08000000, size = 33664
Download [=========================] 100% 33664 bytes
Download done.
File downloaded successfully
$ make clean program
rm -r -f .build .output
sdcc -mpdk14 -c --std-sdcc11 --fverbose-asm --opt-code-size -DPFS154 -DF_CPU=1000000 -DTARGET_VDD_MV=4000 -I. -I../include -o .build/main.rel main.c
sdar -rc .build/lib.lib
sdcc -mpdk14 --out-fmt-ihx -o .output/BlinkLED_WithIRQ_PFS154.ihx .build/main.rel .build/lib.lib
makebin -p .output/BlinkLED_WithIRQ_PFS154.ihx .output/BlinkLED_WithIRQ_PFS154.bin
---------- Segments ----------
. .ABS. 00000000 00000000 = 0. bytes (ABS,CON)
. .ABS. 00000000 00000000 = 0. bytes (ABS,CON)
HEADER1 00000000 00000002 = 2. bytes (ABS,CON)
HEADER3 00000000 00000010 = 16. bytes (ABS,CON)
PREG2 00000000 00000002 = 2. bytes (ABS,CON)
RSEG0 00000000 00000002 = 2. bytes (ABS,CON)
DATA 00000002 00000015 = 21. bytes (REL,CON)
HOME 00000022 00000002 = 2. bytes (REL,CON)
GSINIT 00000024 00000014 = 20. bytes (REL,CON)
GSFINAL 00000038 00000002 = 2. bytes (REL,CON)
CODE 0000003A 00000124 = 292. bytes (REL,CON)
SSEG FFFFFFFF 00000001 = 1. bytes (REL,CON)
------------------------------
Size of BlinkLED_WithIRQ_PFS154.bin: 350 bytes
easypdkprog -n PFS154 write .output/BlinkLED_WithIRQ_PFS154.ihx
Erasing IC... done.
Writing IC (175 words)... done.
Calibrating IC
* IHRC SYSCLK=1000000Hz @ 4.00V ... calibration result: 997066Hz (0x84) done.
$ easypdkprog -V
easypdkprog 1.2