-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when programming or erasing Kinetis microcontrollers #185
Comments
It sounds like you're possibly programming an image that protects the flash? You will need to erase unless you're writing to a region of flash that is already erased. Some sample code would help. |
Hello again! Example K64/KE15: try: Target connectiontry: try: try: Target erasejlink.halt() try: Target connectiontry: try: Flashing .s19time.sleep(1) time.sleep(2) Memory Writetry: print('Memory write data2: %s (bytes)' % jlink.memory_write8(dirdata2, data2)) except Exception as e: Read Modified Memorytry: resultMemoryModifiedData2 = jlink.memory_read8(dirdata2, bytesdata2) except Exception as e: check memprint('Checking memory...') if data1 != resultMemoryModifiedData1: print('ERROR: data1 FAILURE'); jlink.close(); sys.exit() if data2 != resultMemoryModifiedData2: print('ERROR: data2 FAILURE'); jlink.close(); sys.exit() print(' -> Memory checked') Securitytry: Close connectionjlink.close() As I said, this same or similar code works in LPC and iMX. It si true that normally using JLink Lite or JFlash with Kinetis family, it appears a popup talking about flash protection when programming or erasing, in case you want a mass erase you should press 'Yes'. Hope your answer soon :) |
Hm. I'm having a hard time following. There is OTP that permanently locks flash on the Kinetis chips, so even if your image doesn't enable flash security, if you flashed one at one point that did, then flash access would be permanently locked. In terms of the code, I'm having a hard time following. Could you paste a block like:
Then point out the specific line in that block that is causing the issue and whether it is on the first time you run it or subsequent runs. |
Hi!
I'm trying to program devices with different types of microcontrollers, for example: KE15, KL26, K64...
In this case all from the Kinetis family.
I find these two behaviours that I don't know how to solve:
In all cases the error is as follows (mainly):
Failed to erase sectors 0 @ address 0x00000000 (Algo91: Flash protection violation. Flash is write-protected.)
Failed to erase sectors.
Summarising the code steps I do the following:
Unlock seems to work, so I have tried programming directly, without a previous erase. The failure is the same.
I have done something similar for other microcontroller families like LPC and iMX, and I have not had this problem, I can program and delete them without any problem.
Is it related to the library? Or, is it related to these kind of micros? Is a fault that has already been acknowledged and resolved?
Thank you in advance.
Hope you can help me asap :)
The text was updated successfully, but these errors were encountered: