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

0 Members and 1 Guest are viewing this topic.

Offline KaeTo

  • Contributor
  • Posts: 27
  • Country: de
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1350 on: May 20, 2021, 04:54:58 pm »
Okay, thank you. I think that is the case. I use the uC at 8MHz
 

Offline js_12345678_55AA

  • Frequent Contributor
  • **
  • Posts: 337
  • Country: ht
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1351 on: May 25, 2021, 12:59:23 pm »
I added a new example "Noiseplug" to the easy-pdk-showcase-projects: https://github.com/free-pdk/easy-pdk-showcase-projects

* Noiseplug is a chiptune player for ATTiny9 created by "dojoe/shack" presented @evoke2012:
* Pouet: https://www.pouet.net/prod.php?which=59694
* Source: https://github.com/dojoe/noiseplug

Out of curiosity I wanted to see how well assembly code from ATtiny can be ported to PADAUK.
It turned out, very well (unless you use any peripherals like UART or high speed clock (20MHz) from ATtiny it is possible to port assembly programs almost 1:1).

Just for fun I also added a tiny PFS154 emulator which loads an .IHX hex file, interprets the PDK14 instructions and sends the PWM output of TM2 to the host computer's sound device (your host computer needs to run at least @150MHz).
=> https://github.com/free-pdk/easy-pdk-showcase-projects/tree/master/noiseplug/emulation

JS

P.S. @gir:
I modified your bsv makefile to compile for pdk14 and changed 2 things in my emulator (512 instead of 256 syclocks, trigger TM16 int (0x04) instead of TM2 int) and it played the tune very well.
I think you can easily load noiseplug on your hardware (you only need to change the PWM output to use PA4)

---
Video of original ATTiny noiseplug (at demo party EVOKE 2012):


« Last Edit: May 27, 2021, 11:49:31 pm by js_12345678_55AA »
Easy PDK programmer and more: https://free-pdk.github.io
 
The following users thanked this post: gir

Offline gir

  • Contributor
  • Posts: 16
  • Country: at
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1352 on: May 29, 2021, 10:57:05 am »
P.S. @gir:
I modified your bsv makefile to compile for pdk14 and changed 2 things in my emulator (512 instead of 256 syclocks, trigger TM16 int (0x04) instead of TM2 int) and it played the tune very well.
I think you can easily load noiseplug on your hardware (you only need to change the PWM output to use PA4)

nice to see that my assembly was portable enough (i think i did use some magic numbers for bits-in-registers here and there...). and great job on your noiseplug port --  i'm definitely going to try that out!
 

Offline js_12345678_55AA

  • Frequent Contributor
  • **
  • Posts: 337
  • Country: ht
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1353 on: June 04, 2021, 03:54:41 pm »
I stumbled over a comment on github (all in chinese) which is asking if we want to research the PFC886 together...

There is a repository with source here: https://github.com/stm8stm8stm8/pfc886/blob/main/pwm08b.C

Which according to the comment contains code for the "PFC886" IC which is also labeled "MF520".

After following the bread crumbs it turns out that PADAUK offers a special IC for brushless DC motors called the MF520:

http://www.padauk.com.tw/en/product/show.aspx?num=138&kind=44

In fact this seems to be an 8 core PADAUK with flash support  :) 8)

EDIT:After some more digging I found a video of the "making of" the above source code:

https://www.bilibili.com/video/av712877080/

The video contains some captures of the PFC886 datasheet (again all in chinese :-) )

EDIT2: In the video I was able to see that this IC has 512 byte of RAM  :o

Interesting....
« Last Edit: June 05, 2021, 07:40:47 pm by js_12345678_55AA »
Easy PDK programmer and more: https://free-pdk.github.io
 
The following users thanked this post: icraftcrafts

Offline suzhiming

  • Contributor
  • !
  • Posts: 33
  • Country: cn
« Last Edit: June 10, 2021, 09:20:16 am by suzhiming »
 

Offline suzhiming

  • Contributor
  • !
  • Posts: 33
  • Country: cn
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1355 on: June 10, 2021, 09:23:39 am »
/***************************************PFC886+MF520PWM**********************************************/
/***************************************QQ:774145445*************************************************/
/****************************************快手:共同学习STM8*******************************************/
/****************************************20210423****************************************************/
//                     _________   _________
//              PWM2L-|1 pa2    \_/   pa1 20|-PWM2H
//              PWM1L-|2 pa3          pa0 19|-PWM1H
//              pwm0L-|3 pa4          pa7 18|-pwm0H
//                    |4 pa5          pa6 17|-led_1
//         与gnd相连|-|5 nc            nc 16|-|与vdd相连
//                  |-|6 gnd          vdd 15|-|
//                k_1-|7 pb0          pb7 14|-led_2
//                k_2-|8 pb1          pb6 13|-led_3
//                k_3-|9 pb2          pb5 12|-led_4
//                k_4-|10_pb3_________pb4_11|-led_5
#include   "extern.h"
/****************************************************************************************************/
k_1         bit      pb.0;
k_2         bit      pb.1;
k_3         bit      pb.2;
k_4         bit      pb.3;
led_1      bit      pa.6;
led_2      bit      pb.7;
led_3      bit      pb.6;
led_4      bit      pb.5;
led_5      bit      pb.4;
/****************************************************************************************************/
void      zhengxianbo();      //正弦波
void      fuzhi();         //赋值
void      anjian();         //按键
void      yanshi();         //延时
/****************************************************************************************************/
word      a1,b1,c1;
word      yanshi_a1;
/****************************************************************************************************/
void   FPPA0 (void)
{
.ADJUST_IC   SYSCLK=IHRC/4      //   SYSCLK=IHRC/4
pmode      31;         ///8/8/8/8/8/8/8/8带宽共享
fppen   =   0xFF;      //8核全开有8个核心可以分时全部运行,可以分别干8件事8核真爽!
/****************************************************************************************************/
$      led_1      out,low;
$      k_1         in,pull;
$      k_2         in,pull;
/****************************************************************************************************/      //pwm配置
//f----------------0 f----------------0 f----------------0 f----------------0(word,int)
//f----------------0 f----------------0 f----------------0    //12位PWM0,1,2(左对齐)
// ↑上限(pwmcub)    ↑占空比(pwmdt)    |--死区(pwmdz)---|

//上限pwmcub=0xfff0,死区pwmdz=0xff,
//pwm0dtl(先写)pwm0dth,pwm1dtl(先写)pwm1dth,pwm2dtl(先写)pwm2dth,

//最大0xf010,        pwm_h=1+死区,    pwm_l=0,
//最小0x000,0x0010,  pwm_h=0,         pwm_l=1,
//PWM最大0x0fff-死区 =0xf000,
//PWM最小0x0000+2    =0x0020,
//pwm最大值取0xf000-0xff    =<0xef00高脉冲4us
//pwm最小值取0x0020+0xff    =>0x00ff高脉冲4us
/*
a1=0xf010;fuzhi();yanshi();
//a1=0x0000;fuzhi();yanshi();
a1=0x0010;fuzhi();yanshi();
a1=0xf000;fuzhi();yanshi();
a1=0x0020;fuzhi();yanshi();*/
/****************************************************************************************************/
$      pwmgc      enable,updown,reset;
$      pwmgm      protection_enable,ihrc,/4;
//pwmgc      =0b1_0_1_1_0000;      //PWMG控制寄存器位7,停用启用位6,输出状态位5,中心排列模式位4,PWM计数器清零

//pwmgm      =0b0_0_1_0_10_10;      //PWMG分频寄存器位7,上臂反极性位6,下臂反极性位5,臂保护位4,臂保护模式位32,PWM时钟源位10,PWM分频
//pwmgm      =0b0_0_1_0_10_11;      //PWMG分频寄存器

pwmgc1      =0b1_11_0_01_10;      //PWMG控制寄存器1位7,互补发生器位65,三相电机位4,读零位32,PWM5.PWM+位10,PWM4.PWM-

pwmgc2      =0b01_10_01_10;      //PWMG控制寄存器2位76,PWM3.PWM+位54,PWM2.PWM-位32,PWM1.PWM+位10,PWM0.PWM-

pwmcubl      =0b1111_0000;      //pwm上限寄存器l
pwmcubh      =0b1111_1111;      //pwm上限寄存器h

//pwmdz      =0b1111_0000;      //死区寄存器
pwmdz      =0b1111_1111;      //死区寄存器//*注意死区占上臂时间需要扣除

//pwm0dtl      =0b1111_0000;      //pwm0占空比低位寄存器//先写低位
//pwm0dth      =0b1111_1111;      //pwm0占空比高位寄存器

//pwm1dtl      =0b0000_0000;      //pwm1占空比低位寄存器//先写低位
//pwm1dth      =0b1000_0000;      //pwm1占空比高位寄存器

//pwm2dtl      =0b1111_0000;      //pwm2占空比低位寄存器//先写低位
//pwm2dth      =0b0000_0000;      //pwm2占空比高位寄存器

/****************************************************************************************************/
while (1)
{
if(led_1){led_1=0;}   else{led_1=1;}
.delay   10000;
}
}
/****************************************************************************************************/
void   FPPA1 (void)
{
while(1)
{
zhengxianbo();      //正弦波

}
}
/****************************************************************************************************/
void   FPPA2 (void)
{
yanshi_a1      =2000;
while(1)
{
anjian();
}
}
/****************************************************************************************************/
void   FPPA3 (void)
{
   goto   $;
}
/****************************************************************************************************/
void   FPPA4 (void)
{
   goto   $;
}
/****************************************************************************************************/
void   FPPA5 (void)
{
   goto   $;
}
/****************************************************************************************************/
void   FPPA6 (void)
{
   goto   $;
}
/****************************************************************************************************/
void   FPPA7 (void)
{
   goto   $;
}
/****************************************************************************************************/
/*
void   Interrupt (void)
{
   pushaf;

   if (Intrq.T16)
   {   //   T16 Trig
      //   User can add code
      Intrq.T16   =   0;
      //...
   }

   popaf;
}
*/
/****************************************************************************************************///使用spwm_calc生成幅值61184,周内点数48(52),对称,半波模式,
void      zhengxianbo()      //正弦波
{
while(1)
{

 a1 =0x795D; b1 =0xE438; c1 =0x25D3; fuzhi(); yanshi();
// a1 =0x84C8; b1 =0xDF65; c1 =0x1DD4; fuzhi(); yanshi();
 a1 =0x9010; b1 =0xD998; c1 =0x16A9; fuzhi(); yanshi();
// a1 =0x9B1C; b1 =0xD2DD; c1 =0x1063; fuzhi(); yanshi();
 a1 =0xA5D0; b1 =0xCB46; c1 =0x0B11; fuzhi(); yanshi();
// a1 =0xB012; b1 =0xC2E4; c1 =0x06C0; fuzhi(); yanshi();
 a1 =0xB9CC; b1 =0xB9CC; c1 =0x037A; fuzhi(); yanshi();
// a1 =0xC2E4; b1 =0xB012; c1 =0x06C0; fuzhi(); yanshi();
 a1 =0xCB46; b1 =0xA5D0; c1 =0x0B11; fuzhi(); yanshi();
// a1 =0xD2DD; b1 =0x9B1C; c1 =0x1063; fuzhi(); yanshi();
 a1 =0xD998; b1 =0x9010; c1 =0x16A9; fuzhi(); yanshi();
// a1 =0xDF65; b1 =0x84C8; c1 =0x1DD4; fuzhi(); yanshi();
 a1 =0xE438; b1 =0x795D; c1 =0x25D3; fuzhi(); yanshi();
// a1 =0xE805; b1 =0x6DEB; c1 =0x2E92; fuzhi(); yanshi();
 a1 =0xEAC2; b1 =0x628E; c1 =0x37FE; fuzhi(); yanshi();
// a1 =0xEC6A; b1 =0x5761; c1 =0x41FF; fuzhi(); yanshi();
 a1 =0xECF7; b1 =0x4C7E; c1 =0x4C7E; fuzhi(); yanshi();
// a1 =0xEC6A; b1 =0x41FF; c1 =0x5761; fuzhi(); yanshi();
 a1 =0xEAC2; b1 =0x37FE; c1 =0x628E; fuzhi(); yanshi();
// a1 =0xE805; b1 =0x2E92; c1 =0x6DEB; fuzhi(); yanshi();



 a1 =0xE438; b1 =0x25D3; c1 =0x795D; fuzhi(); yanshi();
// a1 =0xDF65; b1 =0x1DD4; c1 =0x84C8; fuzhi(); yanshi();
 a1 =0xD998; b1 =0x16A9; c1 =0x9010; fuzhi(); yanshi();
// a1 =0xD2DD; b1 =0x1063; c1 =0x9B1C; fuzhi(); yanshi();
 a1 =0xCB46; b1 =0x0B11; c1 =0xA5D0; fuzhi(); yanshi();
// a1 =0xC2E4; b1 =0x06C0; c1 =0xB012; fuzhi(); yanshi();
 a1 =0xB9CC; b1 =0x037A; c1 =0xB9CC; fuzhi(); yanshi();
// a1 =0xB012; b1 =0x06C0; c1 =0xC2E4; fuzhi(); yanshi();
 a1 =0xA5D0; b1 =0x0B11; c1 =0xCB46; fuzhi(); yanshi();
// a1 =0x9B1C; b1 =0x1063; c1 =0xD2DD; fuzhi(); yanshi();
 a1 =0x9010; b1 =0x16A9; c1 =0xD998; fuzhi(); yanshi();
// a1 =0x84C8; b1 =0x1DD4; c1 =0xDF65; fuzhi(); yanshi();
 a1 =0x795D; b1 =0x25D3; c1 =0xE438; fuzhi(); yanshi();
// a1 =0x6DEB; b1 =0x2E92; c1 =0xE805; fuzhi(); yanshi();
 a1 =0x628E; b1 =0x37FE; c1 =0xEAC2; fuzhi(); yanshi();
// a1 =0x5761; b1 =0x41FF; c1 =0xEC6A; fuzhi(); yanshi();
 a1 =0x4C7E; b1 =0x4C7E; c1 =0xECF7; fuzhi(); yanshi();
// a1 =0x41FF; b1 =0x5761; c1 =0xEC6A; fuzhi(); yanshi();
 a1 =0x37FE; b1 =0x628E; c1 =0xEAC2; fuzhi(); yanshi();
// a1 =0x2E92; b1 =0x6DEB; c1 =0xE805; fuzhi(); yanshi();


 a1 =0x25D3; b1 =0x795D; c1 =0xE438; fuzhi(); yanshi();
// a1 =0x1DD4; b1 =0x84C8; c1 =0xDF65; fuzhi(); yanshi();
 a1 =0x16A9; b1 =0x9010; c1 =0xD998; fuzhi(); yanshi();
// a1 =0x1063; b1 =0x9B1C; c1 =0xD2DD; fuzhi(); yanshi();
 a1 =0x0B11; b1 =0xA5D0; c1 =0xCB46; fuzhi(); yanshi();
// a1 =0x06C0; b1 =0xB012; c1 =0xC2E4; fuzhi(); yanshi();
 a1 =0x037A; b1 =0xB9CC; c1 =0xB9CC; fuzhi(); yanshi();
// a1 =0x0B11; b1 =0xCB46; c1 =0xA5D0; fuzhi(); yanshi();
 a1 =0x1063; b1 =0xD2DD; c1 =0x9B1C; fuzhi(); yanshi();
// a1 =0x16A9; b1 =0xD998; c1 =0x9010; fuzhi(); yanshi();
 a1 =0x1DD4; b1 =0xDF65; c1 =0x84C8; fuzhi(); yanshi();
// a1 =0x25D3; b1 =0xE438; c1 =0x795D; fuzhi(); yanshi();
 a1 =0x2E92; b1 =0xE805; c1 =0x6DEB; fuzhi(); yanshi();
// a1 =0x37FE; b1 =0xEAC2; c1 =0x628E; fuzhi(); yanshi();
 a1 =0x41FF; b1 =0xEC6A; c1 =0x5761; fuzhi(); yanshi();
// a1 =0x4C7E; b1 =0xECF7; c1 =0x4C7E; fuzhi(); yanshi();
 a1 =0x5761; b1 =0xEC6A; c1 =0x41FF; fuzhi(); yanshi();
// a1 =0x628E; b1 =0xEAC2; c1 =0x37FE; fuzhi(); yanshi();
 a1 =0x6DEB; b1 =0xE805; c1 =0x2E92; fuzhi(); yanshi();


}
}
/****************************************************************************************************/
void      fuzhi()         //赋值
{
pwm0dtl      =a1 $0;      //先写
pwm0dth      =a1 $1;

pwm1dtl      =b1 $0;
pwm1dth      =b1 $1;

pwm2dtl      =c1 $0;
pwm2dth      =c1 $1;
}
/****************************************************************************************************/
void      yanshi()         //延时
{
word      yanshi_b1;
yanshi_b1      =yanshi_a1;
while(yanshi_b1--){}
//while(k_1){.delay 1000;if(k_2==0){a1--;fuzhi();}}      //定在这
//while(!k_1){.delay 1000;}
}
/****************************************************************************************************/
void      anjian()         //按键
{
if(k_1==0)
{
yanshi_a1++;
.delay 800;
}
if(k_2==0)
{
yanshi_a1--;
.delay 800;
}
}
/****************************************************************************************************/
/****************************************************************************************************/
/****************************************************************************************************/
/****************************************************************************************************/
 

Offline LovelyA72

  • Regular Contributor
  • *
  • Posts: 60
  • Country: us
  • Kashikoma from Massachusetts!
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1356 on: June 10, 2021, 09:24:38 am »
In case you didn't know, Suzhiming is that stm8stm8stm8 user on github.
A while ago I introduced FreePDK to him and seems like he's very interested in this project.
He is a Mini-C expert and he's a commercial MCU solution developer.

Btw: these variable names are in Chinese pinyin so they are only make sense to Chinese like us...  :-// but I am helping him with his English.
« Last Edit: June 10, 2021, 09:29:00 am by LovelyA72 »
Kashikoma!
 
The following users thanked this post: icraftcrafts

Offline suzhiming

  • Contributor
  • !
  • Posts: 33
  • Country: cn
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1357 on: June 10, 2021, 09:30:40 am »
i 'm sorry very funny
 

Offline NickE

  • Contributor
  • Posts: 20
  • Country: hu
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1358 on: June 10, 2021, 06:46:18 pm »
This chip is also out of stock at LCSC.
 

Offline suzhiming

  • Contributor
  • !
  • Posts: 33
  • Country: cn
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1359 on: June 11, 2021, 01:30:59 am »
样片的话好办,工程的话还得分型号价格十倍(up*10)
 

Offline suzhiming

  • Contributor
  • !
  • Posts: 33
  • Country: cn
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1360 on: June 11, 2021, 01:34:54 am »
up mew touch mcu flash :pfc161




/*****************pfc161+tm1651********************/
/******************20210608************************/
/****************qq:774145445**********************/
/****************快手:共同学习stm8*****************/
/**************************************************/
//               _______    ______
//          dio-|1 pb7  \_/  pb010|-clk
//              |2 vdd       gnd 9|
//        cs-||-|3 pa7       pa0 8|-hong
//          tk8-|4 pa6       pa4 7|-lv
//          tk9-|5_pa5_______pa3_6|-lan
//       5v
//  pb0--clk
//  pb7--dio
//       gnd
/**************************************************/
#include   "extern.h"
tm1651_clk      bit      pb.0;
tm1651_dio      bit      pb.7;
/**************************************************/
byte      tm1651_a1;
/**************************************************/
void      tm1651_yanshi();      //延时
void      tm1651_start();         //起始信号
void      tm1651_data();         //数据
void      tm1651_ack();         //应答
void      tm1651_stop();         //结束
/**************************************************/
void   FPPA0 (void)
{
.ADJUST_IC   SYSCLK=IHRC/4      //   SYSCLK=IHRC/4
$      tm1651_clk      out,high;      //输出,高
$      tm1651_dio      out,high;
/**************************************************/


tm1651_yanshi();
while (1)
{
tm1651_start();
tm1651_a1   =0b0100_0000;   tm1651_data();      //写数据到显示寄存器,自动地址增加
tm1651_stop();
tm1651_start();
tm1651_a1   =0b1100_0000;   tm1651_data();      //设置地址00H
tm1651_a1   =0b1111_1111;   tm1651_data();
tm1651_a1   =0b0000_0000;   tm1651_data();
tm1651_a1   =0b0000_1111;   tm1651_data();
tm1651_a1   =0b1111_0000;   tm1651_data();
tm1651_stop();
tm1651_start();
tm1651_a1   =0b1000_1011;   tm1651_data();      //显示开,10/16
tm1651_stop();

//while(1){}
}
}

/**************************************************/
void      tm1651_yanshi()      //延时
{
.delay 100;
}
/**************************************************/
void      tm1651_start()         //起始信号
{
tm1651_clk   =1;   tm1651_dio   =1;   tm1651_yanshi();
tm1651_clk   =1;   tm1651_dio   =0;   tm1651_yanshi();

}
/**************************************************/
void      tm1651_data()         //数据
{

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a1.0){tm1651_dio   =1;}   else{tm1651_dio   =0;}
tm1651_clk      =1;tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a1.1){tm1651_dio   =1;}   else{tm1651_dio   =0;}
tm1651_clk      =1;tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a1.2){tm1651_dio   =1;}   else{tm1651_dio   =0;}
tm1651_clk      =1;tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a1.3){tm1651_dio   =1;}   else{tm1651_dio   =0;}
tm1651_clk      =1;tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a1.4){tm1651_dio   =1;}   else{tm1651_dio   =0;}
tm1651_clk      =1;tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a1.5){tm1651_dio   =1;}   else{tm1651_dio   =0;}
tm1651_clk      =1;tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a1.6){tm1651_dio   =1;}   else{tm1651_dio   =0;}
tm1651_clk      =1;tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a1.7){tm1651_dio   =1;}   else{tm1651_dio   =0;}
tm1651_clk      =1;tm1651_yanshi();



tm1651_ack();

}

/**************************************************/
void      tm1651_ack()      //应答
{
$      tm1651_dio      in,pull;
tm1651_clk      =0;   tm1651_yanshi();      //第八个时钟的下降沿
while(tm1651_dio){nop;}
tm1651_clk      =1;   tm1651_yanshi();
$      tm1651_dio      out,low;



}
/**************************************************/
void      tm1651_stop()         //结束
{
tm1651_clk      =0;   tm1651_dio      =0;   tm1651_yanshi();
tm1651_clk      =1;   tm1651_dio      =0;   tm1651_yanshi();
tm1651_clk      =1;   tm1651_dio      =1;   tm1651_yanshi();

}
/**************************************************/
/**************************************************/
/**************************************************/
 

Offline spth

  • Regular Contributor
  • *
  • Posts: 163
  • Country: de
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1361 on: June 11, 2021, 05:25:18 pm »
I stumbled over a comment on github (all in chinese) which is asking if we want to research the PFC886 together...

There is a repository with source here: https://github.com/stm8stm8stm8/pfc886/blob/main/pwm08b.C

Which according to the comment contains code for the "PFC886" IC which is also labeled "MF520".

After following the bread crumbs it turns out that PADAUK offers a special IC for brushless DC motors called the MF520:

http://www.padauk.com.tw/en/product/show.aspx?num=138&kind=44

In fact this seems to be an 8 core PADAUK with flash support  :) 8)

EDIT:After some more digging I found a video of the "making of" the above source code:

https://www.bilibili.com/video/av712877080/

The video contains some captures of the PFC886 datasheet (again all in chinese :-) )

EDIT2: In the video I was able to see that this IC has 512 byte of RAM  :o

Interesting....

The MF520, MF610 and MF616 all have 8 cores and 512 B RAM, and datasheets on the Padauk website. Unfortunately, these BLDC devices have very brief datasheets. Hope I can find a full PFC886 (or similar - if the MF520 is a PFC886 variant, there might be more PFC devices hidden behind PFC610 and PFC616) datasheet.
 
The following users thanked this post: icraftcrafts

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6171
  • Country: fi
    • My home page and email address
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1362 on: June 12, 2021, 04:24:27 am »
Please use [CODE] /* Code goes here */ [/CODE], it will be easier to read.
请把[CODE]放在程序之前,[/CODE]放在程序之后。

Code: [Select]
tm1651_clk =0; tm1651_yanshi();
if(tm1651_a1.1){tm1651_dio =1;} else{tm1651_dio =0;}
tm1651_clk =1;tm1651_yanshi();

Perhaps the following instead? 也许以下?
Code: [Select]
#include "extern.h"

tm1651_clk  bit pb.0;
tm1651_dio  bit pb.7;

byte     tm1651_byte;
#define  tm1651_send(b)   { tm1652_byte = b; tm1651_send_byte(); }

void  tm1651_start()
{
    $ tm1651_clk  out,high;   //输出,高
    $ tm1651_dio  out,high;
    .delay 100

    tm1651_dio = 0;
    .delay 100
}

void  tm1651_send_byte()
{
    byte  bits = 8;
    while (bits > 0) {

        tm1651_clk = 0;
        .delay 100

        SR      tm1651_byte$1
        SWAPC   tm1651_dio

        tm1651_clk = 1;
        .delay 100

        bits--;
    }

    //等待确认

    $ tm1651_dio  in,pull;

    tm1651_clk = 0;
    while (tm1651_dio) {
        nop;
    }

    tm1651_clk = 1;
    $ tm1651_dio  out,low;
}

void  tm1651_stop()
{
    tm1651_clk = 0;
    tm1651_dio = 0;
    .delay 100

    tm1651_clk = 1;
    .delay 100

    tm1651_dio = 1;
    .delay 100
}

void   FPPA0 (void)
{
    .ADJUST_IC    SYSCLK=IHRC/4
    $ tm1651_clk  out,high;   //输出,高
    $ tm1651_dio  out,high;

    .delay 100

    while (1) {

        //写数据到显示寄存器,自动地址增加
        tm1651_start();
        tm1651_send(0b0100_0000);
        tm1651_stop();

        //设置地址00H
        tm1651_start();
        tm1651_send(0b1100_0000);
        tm1651_send(0b1111_1111);
        tm1651_send(0b0000_0000);
        tm1651_send(0b0000_1111);
        tm1651_send(0b1111_0000);
        tm1651_stop();

        //显示开,10/16
        tm1651_start();
        tm1651_send(0b1000_1011);
        tm1651_stop();
    }
}
I'm not sure, though, because I do not have any Padauk MCUs, or the Padauk Mini-C compiler; I am just guessing...

I much prefer sdcc.
 

Offline suzhiming

  • Contributor
  • !
  • Posts: 33
  • Country: cn
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1363 on: June 12, 2021, 06:50:36 am »
IDE0.91: http://www.padauk.com.tw/cn/technical/index.aspx?kind=36
单核:Single core processor    :PMS150G,152,154
WITH TOUCH:                      :PMS161,PMS164(FLASH):PFC161
双核:Dual Core Processor      :PMC232,PMC234(FLASH):PFC232
八核:Eight core processor      :(FLASH):PFC886
 

Offline suzhiming

  • Contributor
  • !
  • Posts: 33
  • Country: cn
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1364 on: June 12, 2021, 07:06:39 am »
new*new*new*
video:https://www.bilibili.com/video/BV1Bw411Z7fN?from=search&seid=6609710309287088602
/*****************pfc161+tm1651********************/
/******************20210608************************/
/****************qq:774145445**********************/
/****************快手:共同学习stm8*****************/
/**************************************************/
//               _______    ______
//          dio-|1 pb7  \_/  pb010|-clk
//              |2 vdd       gnd 9|
//        cs-||-|3 pa7       pa0 8|-hong
//          tk8-|4 pa6       pa4 7|-lv
//          tk9-|5_pa5_______pa3_6|-lan
//       5v
//  pb0--clk
//  pb7--dio
//       gnd
/**************************************************/
#include   "extern.h"
tm1651_clk      bit      pb.0;
tm1651_dio      bit      pb.7;
/**************************************************/
byte      tm1651_a1;
/**************************************************/
void      tm1651_yanshi();      //延时
void      tm1651_start();         //起始信号
void      tm1651_data();         //数据
void      tm1651_ack();         //应答
void      tm1651_stop();         //结束
/**************************************************/
void   FPPA0 (void)
{
.ADJUST_IC   SYSCLK=IHRC/4      //   SYSCLK=IHRC/4
$      tm1651_clk      out,high;      //输出,高
$      tm1651_dio      out,high;
/**************************************************/
//0x7f;0x30;0x6d;0x79;0x33;0x5b;0x5f;0x70;0x7f;0x7b;0x77;0x1f;0x4e;0x3d;0x4f;0x47;

tm1651_yanshi();
while (1)
{
tm1651_start();
tm1651_a1   =0b0100_0000;   tm1651_data();      //写数据到显示寄存器,自动地址增加
tm1651_stop();
tm1651_start();
tm1651_a1   =0b1100_0000;   tm1651_data();      //设置地址00H
/*
tm1651_a1   =0b1111_1111;   tm1651_data();
tm1651_a1   =0b0000_0000;   tm1651_data();
tm1651_a1   =0b0000_1111;   tm1651_data();
tm1651_a1   =0b1111_0000;   tm1651_data();
*/
tm1651_a1   =0x7e;tm1651_data();
tm1651_a1   =0x30;tm1651_data();
tm1651_a1   =0x6d;tm1651_data();
tm1651_a1   =0x79;tm1651_data();
tm1651_stop();
tm1651_start();
tm1651_a1   =0b1000_1011;   tm1651_data();      //显示开,10/16
tm1651_stop();

//while(1){}
}
}

/**************************************************/
void      tm1651_yanshi()      //延时
{
.delay 100;
}
/**************************************************/
void      tm1651_start()         //起始信号
{
tm1651_clk   =1;   tm1651_dio   =1;   tm1651_yanshi();
tm1651_clk   =1;   tm1651_dio   =0;   tm1651_yanshi();

}
/**************************************************/
void      tm1651_data()         //数据
{

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a1.0){tm1651_dio   =1;}   else{tm1651_dio   =0;}
tm1651_clk      =1;tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a1.1){tm1651_dio   =1;}   else{tm1651_dio   =0;}
tm1651_clk      =1;tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a1.2){tm1651_dio   =1;}   else{tm1651_dio   =0;}
tm1651_clk      =1;tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a1.3){tm1651_dio   =1;}   else{tm1651_dio   =0;}
tm1651_clk      =1;tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a1.4){tm1651_dio   =1;}   else{tm1651_dio   =0;}
tm1651_clk      =1;tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a1.5){tm1651_dio   =1;}   else{tm1651_dio   =0;}
tm1651_clk      =1;tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a1.6){tm1651_dio   =1;}   else{tm1651_dio   =0;}
tm1651_clk      =1;tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a1.7){tm1651_dio   =1;}   else{tm1651_dio   =0;}
tm1651_clk      =1;tm1651_yanshi();



tm1651_ack();

}

/**************************************************/
void      tm1651_ack()      //应答
{
$      tm1651_dio      in,pull;
tm1651_clk      =0;   tm1651_yanshi();      //第八个时钟的下降沿
while(tm1651_dio){nop;}
tm1651_clk      =1;   tm1651_yanshi();
$      tm1651_dio      out,low;



}
/**************************************************/
void      tm1651_stop()         //结束
{
tm1651_clk      =0;   tm1651_dio      =0;   tm1651_yanshi();
tm1651_clk      =1;   tm1651_dio      =0;   tm1651_yanshi();
tm1651_clk      =1;   tm1651_dio      =1;   tm1651_yanshi();

}
/**************************************************/
/**************************************************/
/**************************************************/
 

Offline suzhiming

  • Contributor
  • !
  • Posts: 33
  • Country: cn
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1365 on: June 12, 2021, 08:13:18 am »
@js_12345678_55AA
mf520data:http://www.padauk.com.tw/cn/product/show.aspx?num=139&kw=520
English:http://www.padauk.com.tw/upload/doc/MF520%20datasheet_EN_V003_20210115.pdf
China:http://www.padauk.com.tw/upload/doc/MF520%20datasheet_CN_V003_20210115.pdf
pfc886 data Chinese only  E-mail:suzhiming@88.com
 

Offline suzhiming

  • Contributor
  • !
  • Posts: 33
  • Country: cn
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1366 on: June 12, 2021, 08:47:14 am »
@js_12345678_55AA
This is unpublished data.
E-mail To you.or** 如有业务或工程应用问题, 欢迎联络我司业务窗口 Kevin Liu : kevin_liu@padauk.com.tw **
new:MCS11
http://www.padauk.com.tw/cn/product/show.aspx?num=79&kind=85
http://www.padauk.com.tw/upload/doc/MCS11_datasheet_v0%2020_20180420.pdf
 

Offline js_12345678_55AA

  • Frequent Contributor
  • **
  • Posts: 337
  • Country: ht
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1367 on: June 12, 2021, 01:20:53 pm »
@js_12345678_55AA
This is unpublished data.
E-mail To you.or** 如有业务或工程应用问题, 欢迎联络我司业务窗口 Kevin Liu : kevin_liu@padauk.com.tw **
new:MCS11
http://www.padauk.com.tw/cn/product/show.aspx?num=79&kind=85
http://www.padauk.com.tw/upload/doc/MCS11_datasheet_v0%2020_20180420.pdf

@suzhiming: 你可以给我发个邮件,js55aa@88.com
Easy PDK programmer and more: https://free-pdk.github.io
 

Offline suzhiming

  • Contributor
  • !
  • Posts: 33
  • Country: cn
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1368 on: June 13, 2021, 09:13:37 am »
/*****************pfc161+tm1651********************/
/******************20210608************************/
/****************qq:774145445**********************/
/****************快手:共同学习stm8*****************/
/**************************************************/
//               _______    ______
//          dio-|1 pb7  \_/  pb010|-clk
//              |2 vdd       gnd 9|
//        cs-||-|3 pa7       pa0 8|-hong
//          tk8-|4 pa6       pa4 7|-lv
//          tk9-|5_pa5_______pa3_6|-lan
//       5v
//  pb0--clk
//  pb7--dio
//       gnd
/**************************************************/
#include   "extern.h"
tm1651_clk      bit      pb.0;
tm1651_dio      bit      pb.7;
/**************************************************/
byte      tm1651_a0;
byte      tm1651_a1;
byte      tm1651_a2;
byte      tm1651_a3;
byte      tm1651_a4;
/**************************************************/
void      tm1651_yanshi();      //延时
void      tm1651_start();         //起始信号
void      tm1651_data();         //数据
void      tm1651_ack();         //应答
void      tm1651_stop();         //结束
void      tm1651_xianshi();      //显示
/**************************************************/
void      yanshi()
{
.delay 1000000;
}
void   FPPA0 (void)
{
.ADJUST_IC   SYSCLK=IHRC/4      //   SYSCLK=IHRC/4
$      tm1651_clk      out,high;      //输出,高
$      tm1651_dio      out,high;
/**************************************************/
//0x7e;0x30;0x6d;0x79;0x33;0x5b;0x5f;0x70;0x7f;0x7b;0x77;0x1f;0x4e;0x3d;0x4f;0x47;


while (1)
{
tm1651_a1      =0x7e;
tm1651_a2      =0x30;
tm1651_a3      =0x6d;
tm1651_a4      =0x79;
tm1651_xianshi();
yanshi();

tm1651_a1      =0x33;
tm1651_a2      =0x5b;
tm1651_a3      =0x5f;
tm1651_a4      =0x70;
tm1651_xianshi();
yanshi();

tm1651_a1      =0x7f;
tm1651_a2      =0x7b;
tm1651_a3      =0x77;
tm1651_a4      =0x1f;
tm1651_xianshi();
yanshi();

tm1651_a1      =0x4e;
tm1651_a2      =0x3d;
tm1651_a3      =0x4f;
tm1651_a4      =0x47;
tm1651_xianshi();
yanshi();
}
}

/**************************************************/
void      tm1651_yanshi()      //延时
{
.delay 50;
}
/**************************************************/
void      tm1651_start()         //起始信号
{
tm1651_clk   =1;   tm1651_dio   =1;   tm1651_yanshi();
tm1651_clk   =1;   tm1651_dio   =0;   tm1651_yanshi();

}
/**************************************************/
void      tm1651_data()         //数据
{

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a0.0){tm1651_dio   =1;}   else{tm1651_dio   =0;}
nop;nop;nop;      //太快检测不到需要加延时
tm1651_clk      =1;   tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a0.1){tm1651_dio   =1;}   else{tm1651_dio   =0;}
nop;nop;nop;
tm1651_clk      =1;   tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a0.2){tm1651_dio   =1;}   else{tm1651_dio   =0;}
nop;nop;nop;
tm1651_clk      =1;   tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a0.3){tm1651_dio   =1;}   else{tm1651_dio   =0;}
nop;nop;nop;
tm1651_clk      =1;   tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a0.4){tm1651_dio   =1;}   else{tm1651_dio   =0;}
nop;nop;nop;
tm1651_clk      =1;   tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a0.5){tm1651_dio   =1;}   else{tm1651_dio   =0;}
nop;nop;nop;
tm1651_clk      =1;   tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a0.6){tm1651_dio   =1;}   else{tm1651_dio   =0;}
nop;nop;nop;
tm1651_clk      =1;   tm1651_yanshi();

tm1651_clk      =0;   tm1651_yanshi();
if(tm1651_a0.7){tm1651_dio   =1;}   else{tm1651_dio   =0;}
nop;nop;nop;
tm1651_clk      =1;   tm1651_yanshi();



tm1651_ack();

}

/**************************************************/
void      tm1651_ack()      //应答
{
byte      tm1651_ack_a1;
tm1651_ack_a1      =0;

$      tm1651_dio      in,pull;
tm1651_clk      =0;   tm1651_yanshi();      //第八个时钟的下降沿
while(tm1651_dio==1)      //检测低电平
   {
   tm1651_ack_a1      ++;
   if(tm1651_ack_a1>150)      //退出条件(死机)
      {
      $      tm1651_dio      out,low;
      return;
      }
   }
tm1651_clk      =1;   tm1651_yanshi();
$      tm1651_dio      out,low;



}
/**************************************************/
void      tm1651_stop()         //结束
{
tm1651_clk      =0;   tm1651_dio      =0;   tm1651_yanshi();
tm1651_clk      =1;   tm1651_dio      =0;   tm1651_yanshi();
tm1651_clk      =1;   tm1651_dio      =1;   tm1651_yanshi();

}
/**************************************************/
void      tm1651_xianshi()      //显示
{
tm1651_start();
tm1651_a0   =0b0100_0000;   tm1651_data();      //写数据到显示寄存器,自动地址增加
tm1651_stop();
tm1651_start();
tm1651_a0   =0b1100_0000;   tm1651_data();      //设置地址00H
tm1651_a0      =tm1651_a1;   tm1651_data();
tm1651_a0      =tm1651_a2;   tm1651_data();
tm1651_a0      =tm1651_a3;   tm1651_data();
tm1651_a0      =tm1651_a4;   tm1651_data();
tm1651_stop();
tm1651_start();
tm1651_a0   =0b1000_1011;   tm1651_data();      //显示开,10/16
tm1651_stop();
}
/**************************************************/
/**************************************************/
 

Offline suzhiming

  • Contributor
  • !
  • Posts: 33
  • Country: cn
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1369 on: June 14, 2021, 06:33:24 am »
thi is assembler And hex,bin  contact
这个是汇编完的效果,asm文件是怎么转换成.bin烧录文件的,这一步是由烧录器完成的
« Last Edit: June 14, 2021, 06:42:45 am by suzhiming »
 

Offline suzhiming

  • Contributor
  • !
  • Posts: 33
  • Country: cn
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1370 on: June 16, 2021, 10:47:08 am »
It's not a human habit
 

Offline js_12345678_55AA

  • Frequent Contributor
  • **
  • Posts: 337
  • Country: ht
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1371 on: June 17, 2021, 08:49:11 pm »
Hi,

PFC232 write support now uses the "Limited Voltage writing". This makes it possible to use the standard easy-pdk-programmer without modifications.

I also added support for PFC151 and PFC161 ... which are *surprise surprise* ... the *SAME IC*.
Even original writer can write a PFC151 when a PFC161 program is loaded.

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

Offline spth

  • Regular Contributor
  • *
  • Posts: 163
  • Country: de
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1372 on: June 18, 2021, 08:07:45 am »
I also added support for PFC151 and PFC161 ... which are *surprise surprise* ... the *SAME IC*.
Even original writer can write a PFC151 when a PFC161 program is loaded.

Looking at the datasheets, the PFC161 one was created by copying the PFC151 one, changing "PFC151" to "PFC161" (though they forgot two places that still have "PFC151") and adding section 11.2 for the capacitive touch peripheral.

I wonder if the PFC161 is a PFC151 with the cacitive touch peripheral added vs. the PFC151 being a PFC161 where the capacitive touch peripheral failed test.

 

Offline js_12345678_55AA

  • Frequent Contributor
  • **
  • Posts: 337
  • Country: ht
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1373 on: June 18, 2021, 01:11:40 pm »
I wonder if the PFC161 is a PFC151 with the cacitive touch peripheral added vs. the PFC151 being a PFC161 where the capacitive touch peripheral failed test.

...  failed test ...  :-DD :-DD :-DD  What test? Many Padauk data sheets speak about "yield" at programing... basically the customer is doing the test.

Anyway, I will create a small test project to find out. My guess... it is just a marketing variant.

JS
« Last Edit: June 18, 2021, 01:14:24 pm by js_12345678_55AA »
Easy PDK programmer and more: https://free-pdk.github.io
 

Offline suzhiming

  • Contributor
  • !
  • Posts: 33
  • Country: cn
Re: EEVblog #1144 - Padauk Programmer Reverse Engineering
« Reply #1374 on: June 19, 2021, 05:42:18 am »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf