Author Topic: $0.11 PY32F002A: Cortex-M0+ MCU, actually a PY32F030! 32/4KB, 48MHz, PLL, DMA...  (Read 30573 times)

0 Members and 1 Guest are viewing this topic.

Offline DavidAlfaTopic starter

  • Super Contributor
  • ***
  • Posts: 5912
  • Country: es
And the puya programmer s Win-only, i'm linux only.
Edited the first post.
There's a new tool, MCU-Flash-Tools, python-based, which can program PY32 using the embedded bootloader, just like Puya ISP, so you can now use it under linux.
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: bingo600, Bikkel

Offline Bikkel

  • Newbie
  • Posts: 8
  • Country: za
Do you think it is possible to jump from your user code to this bootloader and start using the onboard bootloader without going through the sequence were you have to power up with the boot pin pulled high ?
 

Offline DavidAlfaTopic starter

  • Super Contributor
  • ***
  • Posts: 5912
  • Country: es
Should be posssible. Based on gbm's answer here:
https://community.st.com/t5/stm32-mcus/how-to-jump-to-system-bootloader-from-application-code-on-stm32/ta-p/49424

I got it working with this code:
Code: [Select]
void JumpToBootloader(void)
{
  typedef struct {
      uint32_t Initial_SP;
      void (*Reset_Handler)(void);
  }boot_vectable_t;

  boot_vectable_t * BOOTVTAB =  (boot_vectable_t *) 0x1FFF0000;             // PY32 system bootloader base address;

  __disable_irq();                                                          // Disable all interrupts

  if(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSISYS)        // If not using HSI clock source, set default HSI 8M clock.
  {
    LL_RCC_HSI_Enable();
    while(LL_RCC_HSI_IsReady() != 1);
    LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSISYS);
    while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSISYS);
    LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
    LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1);
    LL_RCC_PLL_Disable();                                                   // Disable PLL
  }

  RCC->AHBENR   = 0x300;                                                    // Disable all peripherals except FLASH and SRAM
  RCC->APBENR1  = 0;
  RCC->APBENR2  = 0;

  RCC->IOPRSTR  = 0xFFFFFFFF;                                               // Reset all ports
  RCC->AHBRSTR  = 0xFFFFFFFF;                                               // Reset all peripherals
  RCC->APBRSTR1 = 0xFFFFFFFF;
  RCC->APBRSTR2 = 0xFFFFFFFF;
  RCC->IOPRSTR  = 0;                                                        // Release resets
  RCC->AHBRSTR  = 0;
  RCC->APBRSTR1 = 0;
  RCC->APBRSTR2 = 0;

  SysTick->CTRL = 0;                                                        // Disable Systick timer

  NVIC->ICER[0]=0xFFFFFFFF;                                                 // Clear Interrupt Enable & Interrupt Pending Registers
  NVIC->ICPR[0]=0xFFFFFFFF;

  __enable_irq();                                                           // Re-enable all interrupts

  __set_MSP(BOOTVTAB->Initial_SP);                                          // Set the MSP
  BOOTVTAB->Reset_Handler();                                                // Jump to bootloader
}


It probably can be optimized by removing unnecessary code, but it's a small function anyways (Uses 168 Bytes of flash).
All the LL calls are basically reg read/write/modify macros or very small inline functions.


Puya ISP finds the mcu in the instant I push the button:
Code: [Select]
int main(void)
{
  system_init();
  while (1)
  {
    led_blink();
    if(!ReadPin(BUTTON))
      JumpToBootloader();
  }
}

Code: [Select]
Send 0x7F...
Receive 0x79
Send 0x7F...
Receive 0x1F
Version:1.0
PID:0x0440
Read UID 128Bytes at 0x1FFF0E00.
00: 31 34 50 41 03 32 36 38 2A 64 E7 00 78 93 05 56
10: FF FF 30 01 BA 78 BA 65 FF FF FF 9A FF FF FF 0A
20: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
30: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
40: E8 10 00 00 E8 30 00 00 0A 51 00 00 E9 72 00 00
50: E2 92 00 00 B7 03 00 00 69 04 00 00 FF FF FF FF
60: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
70: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FLASH:32 KB, SRAM:4 KB
OPTR: 0xB0AA SDKR: 0x001F WRPR: 0xFFFF
« Last Edit: October 02, 2023, 05:39:24 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: Bikkel, IOsetting

Offline true

  • Frequent Contributor
  • **
  • Posts: 329
  • Country: us
  • INTERNET
I'm really interested, so I would be glad if you told me where you're going

What I wrote is that I got it working. A progress report. For some reason "this one thing isn't working" is the only thing that was understood, and perhaps taken both as begging for help and an opportunity to hate on an IDE / platform. I never asked for help nor did I want help. The response was just "your choice sucks" and "use what was made before, it works." Has nothing to do with the progress report.

Really I was more interested in discussing the PY32F002B and if anyone did anything with it yet...

Since you're interested, if you don't mind waiting, I'll post the platformio conf file once I get done with a convention early November. This way I can make sure the config is repeatable and not specific to my setup. Shouldn't require doing any hacky stuff - just make a new project, use the config and PUYA .pack file. If you want it sooner let me know.
 

Offline IOsetting

  • Regular Contributor
  • *
  • Posts: 56
  • Country: cn
I just noticed that Puya has created their account on Gitee
https://gitee.com/puya-semiconductor
and released quite a lot tools and software
https://gitee.com/puya-semiconductor/tools-and-software

A good sign that they are making their software things public and officially supporting GCC
 
The following users thanked this post: bingo600, GromBeestje, DavidAlfa, Bikkel

Offline DavidAlfaTopic starter

  • Super Contributor
  • ***
  • Posts: 5912
  • Country: es
Including notes for the bootloader protocol  :)
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: Bikkel

Offline DavidAlfaTopic starter

  • Super Contributor
  • ***
  • Posts: 5912
  • Country: es
Long story short, I noticed setting RDP1 disables nRST!
My fault, I was clearly disabling it in the config bits when setting RDP!
Had two weeks, 11h/day thanks to stupid sales/management people, was time for a planned order and they didn't had bought the parts yet, so then it was again our mission to save their as$es.
I had already given it all and struggled with this simple task  :palm:.
« Last Edit: November 19, 2023, 08:11:14 am by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline Pixie dust

  • Newbie
  • Posts: 3
  • Country: nl
I checked out the ADC onboard the PY32F003. The converter is quite accurate (jitter of 1 count only). However there is one flaw: If a pin is configured in input mode (not analog) and the voltage of such pin goes beyond the rails (either on the ground side or VDD side) the ADC results of other (analog) pins are messed up. And this while the VDD stays perfectly constant. So the ADC does not strictly convert in the range 0...VDD.

In designs were the onboard protection diodes are used to clamp an input  pin this can be a problem.
 

Offline DavidAlfaTopic starter

  • Super Contributor
  • ***
  • Posts: 5912
  • Country: es
Yeah this is a pretty common issue in plenty of mcus.
Relying on the pin clamping diodes is always a bad idea when using analog peripherals and must be thoroughly tested.
Of course the adc works in the 0...VDD range, the problem comes from the clamping diodes, clamping to VDD+0.6V, those extra 0.6V are causing the behaviour.

If the current consumption is low, even 10K could cause VDD to rise slightly.
You can also play with the pulldown resistors, so they make a voltage divider.
I recall they were about 40-50K, so if interfacing 5V, a 22-33K input resistor will do it.
« Last Edit: November 19, 2023, 08:19:44 am by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline IOsetting

  • Regular Contributor
  • *
  • Posts: 56
  • Country: cn
A newly reported bug:
When IWDG is enabled, if RTC or LPTIM interrupt is triggered(to feed the dog) at the same time when MCU is entering stop mode, there is a possibility that the dog feeding fails and then MCU will reset.
(Source: https://www.cnblogs.com/liwen01/p/17850148.html)

In PY32F002B, using option byte IWDG_STOP may avoid this bug. when IWDG_STOP is set, watchdog stops counting in stop mode.
« Last Edit: November 29, 2023, 12:54:41 pm by IOsetting »
 
The following users thanked this post: bingo600

Offline antst

  • Newbie
  • Posts: 1
  • Country: nl
I'm really interested, so I would be glad if you told me where you're going

What I wrote is that I got it working. A progress report. For some reason "this one thing isn't working" is the only thing that was understood, and perhaps taken both as begging for help and an opportunity to hate on an IDE / platform. I never asked for help nor did I want help. The response was just "your choice sucks" and "use what was made before, it works." Has nothing to do with the progress report.

Really I was more interested in discussing the PY32F002B and if anyone did anything with it yet...

Since you're interested, if you don't mind waiting, I'll post the platformio conf file once I get done with a convention early November. This way I can make sure the config is repeatable and not specific to my setup. Shouldn't require doing any hacky stuff - just make a new project, use the config and PUYA .pack file. If you want it sooner let me know.

Kindly reminding! :)
I just got dev boards and going to start hacking around it. Would be nice to avoid some work with setting up platformi :)
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1989
  • Country: dk
Seems line Puya has gotten their "Device packs" in the "Official" DAP repos.

Install with:

pyocd pack update      - It will "barf a bit" but complete

pyocd pack install PY32

pyocd pack find PY32

Code: [Select]

  Part          Vendor   Pack                Version   Installed 
------------------------------------------------------------------
  PY32F002Ax5   Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F002Bx5   Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F003x4    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F003x6    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F003x7    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F003x8    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F030x4    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F030x6    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F030x7    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F030x8    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F031x4    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F031x6    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F031x7    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F031x8    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F040Cx6   Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F040Cx8   Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F040Cx9   Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F040CxB   Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F040x6    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F040x8    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F040x9    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F040xB    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F071Cx6   Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F071Cx8   Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F071Cx9   Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F071CxB   Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F071x6    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F071x8    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F071x9    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F071xB    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F072Cx6   Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F072Cx8   Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F072Cx9   Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F072CxB   Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F072x6    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F072x8    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F072x9    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F072xB    Puya     Puya.PY32F0xx_DFP   1.2.0     True       
  PY32F303x8    Puya     Puya.PY32F3xx_DFP   1.0.0     True       
  PY32F303xB    Puya     Puya.PY32F3xx_DFP   1.0.0     True       
  PY32F303xC    Puya     Puya.PY32F3xx_DFP   1.0.0     True       
  PY32F403xB    Puya     Puya.PY32F4xx_DFP   1.0.0     True       
  PY32F403xC    Puya     Puya.PY32F4xx_DFP   1.0.0     True       
  PY32F403xD    Puya     Puya.PY32F4xx_DFP   1.0.0     True       
  PY32L020x5    Puya     Puya.PY32L0xx_DFP   1.0.0     True       
  PY32M010x5    Puya     Puya.PY32Mxxx_DFP   1.0.0     True       
  PY32M030x8    Puya     Puya.PY32Mxxx_DFP   1.0.0     True       
  PY32M070xB    Puya     Puya.PY32Mxxx_DFP   1.0.0     True       


1.2.0 Pack is here
https://www.puyasemi.com/uploadfiles/Puya.PY32F0xx_DFP.1.2.0.pack

/Bingo
« Last Edit: December 10, 2023, 03:48:11 pm by bingo600 »
 
The following users thanked this post: DavidAlfa, IOsetting

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1989
  • Country: dk
It was a *** mess to set it up, but I got it working in Eclipse.

@David

I decided to "Fine tune" my PY32 ... And install an IDE to do debugging.

I tried the Cube IDE w. Jlink - I have a Chinese Jlink-OB.
Works a few times (Run to breakpoint) ... But after setting a breakpoint, and "resuming" a few times GDB/Segger/IDE crashes , saying it has run out of breakpoints.
I don't think my OB has Flash BP's licensed.
But i only have the BP at main , and the "other BP" active ...


I then installed Eclipse Embedded (w. Embsys) , and is using my AirF103 DAP-Link probe.
I'm having quite some debug issues here ...
PyOCD is  flashing "fine" (text show in red) ... Well it says flashing 3200 bytes , and the bin fills 3417 bytes  :-/O

The breakpoints seem to work , but the MCU isn't blinking the led ....
Crazy enough BP's work, and show the "loop" variable.

If i "just" press "Run" - the led isn't blinking too.

If i move the project to "makefile" , and still use dap-link to program
The led is blinking  |O

I'm in "deep do..do" here ...

Any hints would be much appreciated.

PC is x64 Mint 21.02

Attached Eclipse Project.

/Bingo
« Last Edit: December 11, 2023, 02:09:45 pm by bingo600 »
 

Offline DavidAlfaTopic starter

  • Super Contributor
  • ***
  • Posts: 5912
  • Country: es
My experience with pyOCD wasn't pretty good... it was a PITA to set up the CMSIS packs, Eclipse and all that, but I remember it working.
After making the Eclipse guide few posts back (Did it for a 100% legal alternative), I never used it again.
I'm running STLINK converted into JLink-OB with no problem else than the daily annoying warning.

You can only set 2 or 3 breakpoints, if you add more you'll have to delete or disable others.
Plus ensure to remove "Halt at main" in the debug launch options, as it will use another breakpoint.
I have no problem whatsoever with breakpoints, just remember they're finite! :)


BTW, these puyas have started to get more expensive, 2-4 cents more in small quantities!
« Last Edit: December 11, 2023, 02:44:28 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1989
  • Country: dk
I got Eclipse to compile & flash

I seem to have an issue with the clock init

Code: [Select]
#if 0
  BSP_RCC_HSI_PLL48MConfig();
  SysTick_Config(480000);
#else
  LL_RCC_HSI_SetCalibFreq(LL_RCC_HSICALIBRATION_24MHz);
  while (LL_RCC_HSI_IsReady() != 1);
  SysTick_Config(24000);      // 24MHz cpu clock, 1ms period.
#endif

If i set it at 48M ,  it runs super slow
If i use the 24M , it runs as expected ...

Hmmm .....

Isn't there a zero to much in that 48M systick ?

« Last Edit: December 11, 2023, 04:43:26 pm by bingo600 »
 

Offline DavidAlfaTopic starter

  • Super Contributor
  • ***
  • Posts: 5912
  • Country: es
Yep, 480.000 will make a 10ms tick period (100Hz), 10 times slower.
Change to 48.000, fixed!
« Last Edit: December 11, 2023, 05:02:58 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1989
  • Country: dk
I'm running STLINK converted into JLink-OB with no problem else than the daily annoying warning.

Interesting ....
Is it "just" connect a China "USB-Stick" lookalike ST-Link , and then "convert" it ...
And it isn't locked to "Just ST MCU's" ?

Any hints ... ?

Ohh ... I suppose t has to be a F103 ST-link or ??
Some of the clones uses a F101 i think ...


You can only set 2 or 3 breakpoints, if you add more you'll have to delete or disable others.
Plus ensure to remove "Halt at main" in the debug launch options, as it will use another breakpoint.
I have no problem whatsoever with breakpoints, just remember they're finite! :)
That's the strange thing ...
I have "The main breakpoint"  , and ONE other breakpoint.
I just press ""Run" , and it breaks at the LED togle
I press Run gain ... It works
After 4..6 "Run's"  it crashes with "No more breakponts"
But i never set any more ....

I'll try to remove the break at main

BTW, these puyas have started to get more expensive, 2-4 cents more in small quantities!
That's quite a lot , when you think about they were 11cent

It got 100 of each ... F003 & F002a15 in 20-ssop , and F002a15 in 16tsop


I just got Eclipse debug to behave .....
I had to give it a SVD file , in order to see the periph. registers



« Last Edit: December 11, 2023, 05:57:31 pm by bingo600 »
 

Offline DavidAlfaTopic starter

  • Super Contributor
  • ***
  • Posts: 5912
  • Country: es
Is it "just" connect a China "USB-Stick" lookalike ST-Link , and then "convert" it ...
It's a stlink v2 clone, but the full one (White plastic housing), then reflashed to OB.

And it isn't locked to "Just ST MCU's" ?
"Yes", but read 1st post.

Ohh ... I suppose t has to be a F103 ST-link or ?? Some of the clones uses a F101 i think ...
AFAIK it only needs to be a CB (128K) part, but genuine stm32, not apm32, etc.

But i never set any more ....
Edit: I can set up to 4 breakpoints just fine!
More than that and I get the window asking to buy a license for unlimited flash breakpoints.

If you have a spare stm32f103 BluePill send me a PM, I have a binary you can try out.
« Last Edit: December 11, 2023, 06:10:40 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: bingo600

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1989
  • Country: dk
Only 2 breakpoints then!
Keep in mind that step-out action needs a free breakpoint. Single step, run, halt...don't.

I suppose that's what bites me ....


Yeah the best is to remove startup breakpoint. Put it at main if you want, but that way you can disable it later on.
Keep an eye at the breakpoints window!

Edit: I can set up to 4 breakpoints just fine!
More than that and I get the window asking to buy a license for unlimited flash breakpoints.

Neat  ....
I suppose the "Unlimited flash BP" is the "Dongle" reprogramming the flash , and inserts BP's there

I haven't tried more than 2 BP's (Main + an extra)
But i suppose i don't need the BP at main ...

If that frees up a BP . that i can use for a "Line", and then have the other for stepping. That would be fine for me.

But right now Eclipse + pyocd seems to behave quite ok ...

/Bingo

Ps: Thanx for the assistance  :-+ :-+
Pps: Did you see the picts i inserted above ...
 

Offline DavidAlfaTopic starter

  • Super Contributor
  • ***
  • Posts: 5912
  • Country: es
I see you anwered to my previous message before editing, please re-read.
Yeah I saw your picture...
I had to give it a SVD file , in order to see the periph. registers
Did you follow all the steps here?
Though I used an external pack file, as it wasn't included in pyOCD back then.

Maybe the breakpoint issue is a DAP or PyOCD thing? I'm not using that...
Try Jlink just in case?
« Last Edit: December 11, 2023, 06:25:19 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1989
  • Country: dk
I see you anwered to my previous message before editing, please re-read.
Yeah I saw your picture...
I had to give it a SVD file , in order to see the periph. registers
Did you follow all the steps here?
Though I used an external pack file, as it wasn't included in pyOCD back then.

Maybe the breakpoint issue is a DAP or PyOCD thing? I'm not using that...
Try Jlink just in case?

I did follow your "Guide quite a lot" ... It helped great.
But remember i'm on linux, there could be differences ....

The BP issue i have was with CubeIDE + JlinkOB

So far ...
It seems like Eclipse + pyOCD + DAP-debugger runs quite nice ....



Btw: I tried to upgrade 1.13 CubeIDE "online" to 1.14 ... It broke .... PROB DON'T do that ...

I ended up deleting 1.13 , and reinstall
And DL + Install 1.14 instead of upgrade They can coexist , in different dir's ...   (Had to do the Java mod etc ... Again) , but you described it nicely  :-+

I'm glad i got my 2TB NVME


Edit:
I think i just "killed" a PY002 tsop-16 ...
During my "fight" with Eclipse , i loaded the "RDP test program" you made.
And the CLI-DAP flasher - Gave an error and Couldn't verify ...
But the program isn't running either (no led blink) , so i can't disable RDP.

Maybe it's time to try that "linux" puya-programmer ....
Is it via seria interface l, that you "remove the RDP" on windows ??

Well it was 11cent ... The tsop to DIP adapter was more expensive   ;)

/Bingo
« Last Edit: December 11, 2023, 08:17:44 pm by bingo600 »
 

Offline DavidAlfaTopic starter

  • Super Contributor
  • ***
  • Posts: 5912
  • Country: es
The BP issue i have was with CubeIDE + JlinkOB
I never tested this. Only Jlink in CubeIDE.

Btw: I tried to upgrade 1.13 CubeIDE "online" to 1.14 ... It broke .... PROB DON'T do that ...
CubeIDE always broke for me when updating. I just delete everything and install from zero.

Keep in mind you'll have to manually patch that new IDE version (Just follow the included instructions).
Pasting the zip contents will likely break something, as the included plugins will be newer.
I kept 1.2.1 because of the stupid login thing. It's not just annoying, also screwed up my STM32 soldering FW automated building script.
So feeeck it :)
« Last Edit: December 11, 2023, 06:57:25 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1989
  • Country: dk
Seems like my PY32F002AW15S (TSOP-16) is "gone"  :palm:
Somehow it went bannanas during programming of Davids RDP-Test program.
Now there's no led blink or .....

Well i looked at the new PuyaISP python program, to unprotect the device.
In order to activate the serial bootloader you need to pull Boot0 "high" ....
Well  :scared:  on a TSOP-16 there's no PF4/Boot0 pin  |O

Wonder how they will utilize serial bootloader on that one wo. a Boot0 pin ????

Big loss 11c  :-DD
The TSOP to DIP adapter was more ...

Lesson learned ... Use a TSSOP-20 for playing around with RDP.

But then again ... A bit strange the < 20 pin , doesn't seem to be able to use the serial boot loader

/Bingo
 

Offline DavidAlfaTopic starter

  • Super Contributor
  • ***
  • Posts: 5912
  • Country: es
But my test allowed RDP to be erased in software by pressing a button ?

Bingo600, as you asked in PM, here's a very simple example showing how to lock and unlock RDP.
PB0 = button to GND.
PB1 = RED led ( To indicate lock)
PB3 = GREEN led (Activity and unlocked indicator)

LEDS are active low - Connect between VCC and the mcu pin through a 470R-1K resistor.


Simply flash it - RED will be steady on, GREEN blinking as "I'm alive".
Press button - GREEN will be steady on, RED off. MCU will be wiped, cycle power to update RDP security, Jlink will be able to program it again.

Just in case, I'm only setting RDP1 in this test, not disabling nRST or BOOT0, at $0.11 it's cheap but better to not brick any! (I'm using the "full" mode myself, works perfect).

Wonder how they will utilize serial bootloader on that one wo. a Boot0 pin ????
I don't think you can.
BTW why the SO-16 package? The TSSOP20 is cheaper, has more pins while being ~30% smaller, and it's not hard to solder either!
In fact, it's the only package with BOOT0...

« Last Edit: December 12, 2023, 10:30:22 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1989
  • Country: dk
But my test allowed RDP to be erased in software by pressing a button ?

Bingo600, as you asked in PM, here's a very simple example showing how to lock and unlock RDP.
PB0 = button to GND.
PB1 = RED led ( To indicate lock)
PB3 = GREEN led (Activity and unlocked indicator)

LEDS are active low - Connect between VCC and the mcu pin through a 470R-1K resistor.


Simply flash it - RED will be steady on, GREEN blinking as "I'm alive".
Press button - GREEN will be steady on, RED off. MCU will be wiped, cycle power to update RDP security, Jlink will be able to program it again.

Just in case, I'm only setting RDP1 in this test, not disabling nRST or BOOT0, at $0.11 it's cheap but better to not brick any! (I'm using the "full" mode myself, works perfect).

Wonder how they will utilize serial bootloader on that one wo. a Boot0 pin ????
I don't think you can.
BTW why the SO-16 package? The TSSOP20 is cheaper, has more pins while being ~30% smaller, and it's not hard to solder either!
In fact, it's the only package with BOOT0...

Well i have both ....
But also wanted one that was easy solderable, for a friend ....

From now on , i'll use the TSSOP-20 for playing around.

/Bingo
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf