And the puya programmer s Win-only, i'm linux only.
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
}
int main(void)
{
system_init();
while (1)
{
led_blink();
if(!ReadPin(BUTTON))
JumpToBootloader();
}
}
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
I'm really interested, so I would be glad if you told me where you're going
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.
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
It was a *** mess to set it up, but I got it working in Eclipse.
#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
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!
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" ?
Ohh ... I suppose t has to be a F103 ST-link or ?? Some of the clones uses a F101 i think ...
But i never set any more ....
Only 2 breakpoints then!
Keep in mind that step-out action needs a free breakpoint. Single step, run, halt...don't.
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.
I had to give it a SVD file , in order to see the periph. registers
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. registersDid 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?
The BP issue i have was with CubeIDE + JlinkOB
Btw: I tried to upgrade 1.13 CubeIDE "online" to 1.14 ... It broke .... PROB DON'T do that ...
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 ?
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...