Author Topic: EEVblog #1144 - Padauk Programmer Reverse Engineering  (Read 399409 times)

0 Members and 2 Guests are viewing this topic.

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1904
  • Country: ca
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #800 on: November 27, 2019, 02:10:16 pm »
Also Please check this out the getchar is working but it would receive it wrong! instead of getting 0x61 which is an "a" char, it would receive  it like 0x27


Here is the main loop code from the serialio example

Code: [Select]
char c='';
for(;;)
  {
    puts("Echoing serial receive (type something):\r\n");
    for(int i=0;i<10000;i++);
    c = getchar();
    for(int i=0;i<10000;i++);
    putchar(c);
}
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline js_12345678_55AA

  • Frequent Contributor
  • **
  • Posts: 341
  • Country: ht
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #801 on: November 28, 2019, 12:22:06 pm »
Also Do you have some ADC examples?

I added an ADC example (for PFS173) to the development branch.

It shows how to measure the ADC value of the internal BandGap voltage (VBG = 1.200V) which then can be used to calculate VDD:
VDD (?) => max value of ADC = 255
VBG (1.2V) => adcval

==> VDD = (1.2 * 255 ) / adcval

Then it shows how to measure input of PA.0. (Note: when running in easypdk programmer, PA.0 is pulled up to VDD of the programmer which is 3.3V).


Have fun,

JS


P.S. The serial echo sample is not finished yet. Looks like the interrupt takes way to many cycles. It either needs optimization or the BAUD rate needs to be lowered.
Easy PDK programmer and more: https://free-pdk.github.io
 
The following users thanked this post: icraftcrafts

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1904
  • Country: ca
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #802 on: November 28, 2019, 12:34:36 pm »
Thanks JS, I think if we add a delay after puts, we would get the RX wrong! maybe there is a bug in the compiler.
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline js_12345678_55AA

  • Frequent Contributor
  • **
  • Posts: 341
  • Country: ht
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #803 on: November 29, 2019, 06:01:38 pm »
Hi,

I added more example programs to the easypdk programmer (in development branch: https://github.com/free-pdk/easy-pdk-programmer-software/tree/development/Examples )

* COMPtest shows how to use the comparator to estimate VDD (good for battery based projects on ICs without ADC).

* PolySound is a fun project which uses PWM to play a polyphonic sound. It emulates a NES sound chip with 4 voices to play a music theme from Mega Man 2. It requires 182 bytes RAM and 2.1k words CODE (e.g. PFS173).
   You only need to connect a speaker to PA.3 and GND  :). Of course a low pass filter for the PWM would be much better.
   The original project was implemented for a PIC16 by Joel Yliluoma : https://bisqwit.iki.fi/jutut/kuvat/programming_examples/pic/
   To stay as close as possible to the original code, SYSCLK is tuned (overclocked) to 10MHz - which works absolutely fine  8)

   Attached is a sound file of the output (low pass filtered)  ;D

Have fun,

JS
Easy PDK programmer and more: https://free-pdk.github.io
 
The following users thanked this post: icraftcrafts, I wanted a rude username

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1904
  • Country: ca
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #804 on: November 29, 2019, 09:16:43 pm »
Thanks JS :-+
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline hidden

  • Contributor
  • Posts: 11
  • Country: cn
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #805 on: December 12, 2019, 03:11:51 am »
The depdk converted bin file cannot be written to the target chip using easypdkprog Is there a way to convert the bin file to an ihx file ?
Please forgive me for not understanding English. I translated it using google.
« Last Edit: December 12, 2019, 09:39:46 am by hidden »
 

Offline hidden

  • Contributor
  • Posts: 11
  • Country: cn
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #806 on: December 12, 2019, 09:10:31 am »
FYI, I ventured out and reviewed all sub $0.10 microcontrollers on LCSC. I hope it's somewhat useful:

https://cpldcpu.wordpress.com/2019/08/12/the-terrible-3-cent-mcu/

I can now confirm that the Padauk MCUs are the best in this segment. We knew this before, did we?

Well, now back to actual projects on the PFS154...
Cheap MCUs that are widely used in China are OTP produced by Taiwan nyquest. My purchase of NY8A050D is only RMB 0.1 yuan, about 0.014 US dollars.
nyquest website :   http://www.nyquest.com.tw/
Attached is the NY8A050D&HR7P153 English Datasheet,Please accept.
« Last Edit: December 12, 2019, 09:24:02 am by hidden »
 
The following users thanked this post: I wanted a rude username

Offline hidden

  • Contributor
  • Posts: 11
  • Country: cn
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #807 on: December 12, 2019, 11:07:31 am »
Thanks JS, I managed to flash the Dev branch to the ARM and now it's working, But still only probing is working |O |O |O any Idea what might goes wrong?

Now you have to check your hardware variant. On the picture I saw that C1 is not populated and also Y1 is missing. A cap on the 15V rail is essential since VCC/VDD draw some power during programing. The crystal is used to get better tuning results after the CPU is flashed, without it the drift might be much higher or you create a very special clock path using the HSI48 with sync to USB frames (then programmer can not be used stand alone - a feature planned for future use, just like WRITER).

Also, since you changed the opamp, it might be possible that the output voltages differ. You can use the "easypdkprogtest" program to check that the output voltage is correct:

DO THIS WITHOUT A MCU CONNECTED TO THE PROGRAMMER

make easypdkprogtest

./easypdkprogtest
vdd: 5.01   vpp: 4.98    (vref= 3.30)


Please check that VDD and VPP are 5V and VREF is 3.3V. Also measure them on your PCB.

In case VDD and VPP voltages are incorrect you need to tune the DAC reference values for your specific hardware (in fpdk.c you need to change FPDK_VDD_DAC_MAX_MV / FPDK_VPP_DAC_MAX_MV).


JS

Where to get it "easypdkprogtest" program ? File Directory path . Thanks!
 

Offline js_12345678_55AA

  • Frequent Contributor
  • **
  • Posts: 341
  • Country: ht
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #808 on: December 12, 2019, 04:09:40 pm »
The depdk converted bin file cannot be written to the target chip using easypdkprog Is there a way to convert the bin file to an ihx file ?

There is no way to "convert" a PDK file. PDK files contain extra code which the original WRITER device form PADAUK needs to modify during writing.
You can use SDCC (a real C compiler) to create wonderful programs.

Where to get it "easypdkprogtest" program ? File Directory path . Thanks!

The source code is inside of the github project (you need to compile it yourself) : https://github.com/free-pdk/easy-pdk-programmer-software


JS
Easy PDK programmer and more: https://free-pdk.github.io
 

Offline js_12345678_55AA

  • Frequent Contributor
  • **
  • Posts: 341
  • Country: ht
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #809 on: December 12, 2019, 04:31:04 pm »
Hi,

I just released version 1.2 of the EasyPDK programmer software: https://github.com/free-pdk/easy-pdk-programmer-software/releases/tag/1.2


The following features are fully implemented now:

FUSES: Setup fuses from SDCC source code
SYSCLOCK IHRC: Tuning (500kHz - 8MHz, overclocking up to 11MHz possible)
SYSCLOCK ILRC: Tuning (3-100kHz)
BANDGAP: BG tuning (1.2V)

There is example code for FUSES and calibrations in "calib-and-fuse-demo.c".


I think it is now feature complete for PMS150C, PFS154 and PFS173. Next steps: adding new IC types.


=> DON'T FORGET TO UPDATE THE PROGRAMMER FIRMWARE <=

Have fun,

JS
Easy PDK programmer and more: https://free-pdk.github.io
 
The following users thanked this post: icraftcrafts, I wanted a rude username, hidden

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1904
  • Country: ca
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #810 on: December 12, 2019, 10:07:10 pm »
Big thumbs up JS, Please add the industrial grade parts with ADC as the first Step :)
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline hidden

  • Contributor
  • Posts: 11
  • Country: cn
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #811 on: December 13, 2019, 07:38:01 am »

What does RO mean in brackets on the right of the list?



Thanks JS ! version 1.2 verygood !
« Last Edit: December 15, 2019, 10:26:23 am by hidden »
 

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1904
  • Country: ca
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #812 on: December 14, 2019, 03:19:29 pm »
JS please add PMC131 and PMC271 parts support, they are industrial grade and have ADC
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline spth

  • Regular Contributor
  • *
  • Posts: 163
  • Country: de
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #813 on: December 14, 2019, 05:54:49 pm »
JS please add PMC131 and PMC271 parts support, they are industrial grade and have ADC

I suggest to file feature requests for those two at GitHub:

https://github.com/free-pdk/easy-pdk-programmer-software/issues
 

Offline hidden

  • Contributor
  • Posts: 11
  • Country: cn
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #814 on: December 15, 2019, 09:45:09 am »
I used to be on this topic downloaded a command line utility  that can parse the PDK file , and it can show which IC types  the PDK file was compiled . But now I can't find that command line utility through this topic. Do you help me find it ?
« Last Edit: December 15, 2019, 09:47:46 am by hidden »
 

Offline js_12345678_55AA

  • Frequent Contributor
  • **
  • Posts: 341
  • Country: ht
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #815 on: December 16, 2019, 04:56:58 pm »

What does RO mean in brackets on the right of the list?

RO stands for Read-Only - which means writing the IC is not fully implemented / tested yet.


I used to be on this topic downloaded a command line utility  that can parse the PDK file , and it can show which IC types  the PDK file was compiled . But now I can't find that command line utility through this topic. Do you help me find it ?

The decryption tool is on page 2 of this thread, post #28:  https://www.eevblog.com/forum/blog/eevblog-1144-padauk-programmer-reverse-engineering/msg1946371/#msg1946371

This (experimental) tools are also included in the FREEPDK github repository: https://github.com/free-pdk  ==> fppa-pdk-tools
  => depdk.c (decryption tool)
  => dispdk.c (disassembler, can open PDK file directly and outputs which CPU was used and disassembly)

This are experimental tools, used during devlopment only. They do not and will not support all IC types and all flavors of PDK files.


Have fun,

JS
Easy PDK programmer and more: https://free-pdk.github.io
 
The following users thanked this post: icraftcrafts

Offline js_12345678_55AA

  • Frequent Contributor
  • **
  • Posts: 341
  • Country: ht
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #816 on: December 16, 2019, 05:05:07 pm »
JS please add PMC131 and PMC271 parts support, they are industrial grade and have ADC

Hi, PMS and PMC variants are 100% identical regarding compiler and programmer.

Do you have a specific project you might share, which is intended to run on a PMC part with ADC? By sharing a project the motivation to support a specific IC type would increase a lot  :).

Personally I found that PFS173 is by far the best option for almost everything. It has big FLASH, ADC, 256 byte RAM and they are available as SOT23-6, SOP8, SOP14, SOP16, ... as cheap as USD 0.05 (https://item.taobao.com/item.htm?id=598420620199 ) or USD 0.07 (https://lcsc.com/product-detail/Others_PADAUK-Tech-PFS173-S08_C337970.html)

Have fun,

JS

Easy PDK programmer and more: https://free-pdk.github.io
 

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1904
  • Country: ca
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #817 on: December 17, 2019, 06:14:07 am »
Thanks JS, I find the PFS173 to be very useful, I need it to capture some Signals with ADC and send them over uart! The only problem with PFS173 is the working temperature! it's not -40 to 85C, so It can not be used inside industrial gears, Also the SOT23-6 package is very nice to have. then unfortunately we do not have something in the -40 to 85c in the PMC parts :palm:

If the PFS173 temperature range was industrial, then we where in heaven :)
I think these babies can be used in very low cost PLC ADC modules ;)
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 
The following users thanked this post: icraftcrafts

Offline spth

  • Regular Contributor
  • *
  • Posts: 163
  • Country: de
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #818 on: December 17, 2019, 07:56:18 am »
Thanks JS, I find the PFS173 to be very useful, I need it to capture some Signals with ADC and send them over uart! The only problem with PFS173 is the working temperature! it's not -40 to 85C, so It can not be used inside industrial gears, Also the SOT23-6 package is very nice to have. then unfortunately we do not have something in the -40 to 85c in the PMC parts :palm:

You mean "in the PFS parts", I guess. The PMC and PFC parts are -40°C to +85°C.
 

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1904
  • Country: ca
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #819 on: December 18, 2019, 12:59:23 pm »
why PFS173 would not boot properly when connected to an external 5V supply to work as stand alone? :palm:
should be reset pulled up to VCC? I have done it and got no luck!
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline js_12345678_55AA

  • Frequent Contributor
  • **
  • Posts: 341
  • Country: ht
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #820 on: December 19, 2019, 04:10:52 pm »
why PFS173 would not boot properly when connected to an external 5V supply to work as stand alone? :palm:
should be reset pulled up to VCC? I have done it and got no luck!

You do not have to connect RESET pin to anywhere. The RESET pin is only used in case YOUR program sets up PRSTB bit in CLKMD register.

In case your program is not running after flashing this can have several causes:
- check that you disabled watchdog, or when enabled that you call WDRESET periodically
- check that you disabled LVR or that you set LVR to a level greater or equal to VCC
- make sure your CLKMD setup (e.g. switching from ILRC to IHRC does not disable the old clock source immediately (see note in PFS173 PDF about clock switching).

If you can't work it out yourself, posting your program source code would enable others to have a look.

JS
Easy PDK programmer and more: https://free-pdk.github.io
 

Offline spth

  • Regular Contributor
  • *
  • Posts: 163
  • Country: de
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #821 on: December 20, 2019, 11:25:42 am »
There will be a short talk on the free toolchain for the Padauk µC on 12:00 Sunday the 2nd of February at FOSDEM 2020:

https://fosdem.org/2020/schedule/event/paduak_toolchain/

Philipp
 
The following users thanked this post: js_12345678_55AA, tim_

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1904
  • Country: ca
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #822 on: December 21, 2019, 06:46:53 am »
Dear JS, It's now solved! the problem was the FTDI chip that was making some power into the chip when it was not powerd!
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline tim_

  • Regular Contributor
  • *
  • Posts: 237
  • Country: de
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #823 on: January 10, 2020, 12:25:32 am »
There will be a short talk on the free toolchain for the Padauk µC on 12:00 Sunday the 2nd of February at FOSDEM 2020:

https://fosdem.org/2020/schedule/event/paduak_toolchain/

Nice! Will the talk be recorded? Or will at least the slides be available?

Btw, where do you get the €0.01 from? Haven't seen an update at LCSC for a long time. I am still waiting for the PFS232 to become available.

I have designed a tiny new project with the PFS154. Will assemble and write it up in about two weeks when the parts arrive.
 

Offline spth

  • Regular Contributor
  • *
  • Posts: 163
  • Country: de
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #824 on: January 10, 2020, 12:21:44 pm »
There will be a short talk on the free toolchain for the Padauk µC on 12:00 Sunday the 2nd of February at FOSDEM 2020:

https://fosdem.org/2020/schedule/event/paduak_toolchain/

Nice! Will the talk be recorded? Or will at least the slides be available?

Slides will become available  a few hour before the talk. FOSDEM records all talks (https://video.fosdem.org/), but in the past I've sometimes experienced technical problems (e.g. distortion and the leftmost part of my slides missing in the recording of one of my FOSDEM 2018 talks https://ftp.fau.de/fosdem/2018/UD2.218A/stm8.mp4).

Quote

Btw, where do you get the €0.01 from?

I've seen that price for the PMS15A (at a minimum order of 10) at various places.
« Last Edit: January 10, 2020, 12:32:25 pm by spth »
 
The following users thanked this post: icraftcrafts


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf