Fix NVM by clearing FLASH_FLAG_PGPERR
This commit is contained in:
parent
661c20dd18
commit
4c5e7520f5
@ -23,7 +23,7 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#define MICROPY_HW_BOARD_NAME "THUNDERPACK"
|
#define MICROPY_HW_BOARD_NAME "THUNDERPACK_v11"
|
||||||
#define MICROPY_HW_MCU_NAME "STM32F411CE"
|
#define MICROPY_HW_MCU_NAME "STM32F411CE"
|
||||||
|
|
||||||
// Non-volatile memory config
|
// Non-volatile memory config
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
#define FLASH_PAGE_SIZE (0x4000)
|
#define FLASH_PAGE_SIZE (0x4000)
|
||||||
#define BOARD_FLASH_SIZE (FLASH_SIZE - CIRCUITPY_INTERNAL_NVM_SIZE- 0x2000 - 0xC000)
|
#define BOARD_FLASH_SIZE (FLASH_SIZE - CIRCUITPY_INTERNAL_NVM_SIZE- 0x2000 - 0xC000)
|
||||||
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0x8000
|
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0x8000
|
||||||
#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000
|
|
||||||
|
|
||||||
// On-board flash
|
// On-board flash
|
||||||
#define SPI_FLASH_MOSI_PIN (&pin_PB15)
|
#define SPI_FLASH_MOSI_PIN (&pin_PB15)
|
||||||
@ -45,15 +44,14 @@
|
|||||||
#define SPI_FLASH_SCK_PIN (&pin_PB13)
|
#define SPI_FLASH_SCK_PIN (&pin_PB13)
|
||||||
#define SPI_FLASH_CS_PIN (&pin_PB12)
|
#define SPI_FLASH_CS_PIN (&pin_PB12)
|
||||||
|
|
||||||
|
#define HSE_VALUE ((uint32_t)24000000U)
|
||||||
|
#define BOARD_OVERWRITE_SWD (1)
|
||||||
|
#define BOARD_NO_VBUS_SENSE (1)
|
||||||
|
#define BOARD_HAS_LOW_SPEED_CRYSTAL (0)
|
||||||
|
|
||||||
// Status LEDs
|
// Status LEDs
|
||||||
#define MICROPY_HW_APA102_MOSI (&pin_PB08)
|
#define MICROPY_HW_APA102_MOSI (&pin_PB08)
|
||||||
#define MICROPY_HW_APA102_SCK (&pin_PB00)
|
#define MICROPY_HW_APA102_SCK (&pin_PB00)
|
||||||
|
|
||||||
// I2C
|
// I2C
|
||||||
#define DEFAULT_I2C_BUS_SCL (&pin_PB06)
|
#define DEFAULT_I2C_BUS_SCL (&pin_PB06)
|
||||||
#define DEFAULT_I2C_BUS_SDA (&pin_PB07)
|
#define DEFAULT_I2C_BUS_SDA (&pin_PB07)
|
||||||
|
|
||||||
// General config
|
|
||||||
#define BOARD_OSC_DIV (24)
|
|
||||||
#define BOARD_OVERWRITE_SWD (1)
|
|
||||||
#define BOARD_NO_VBUS_SENSE (1)
|
|
||||||
|
@ -11,6 +11,7 @@ EXTERNAL_FLASH_DEVICE_COUNT = 1
|
|||||||
EXTERNAL_FLASH_DEVICES = GD25Q16C
|
EXTERNAL_FLASH_DEVICES = GD25Q16C
|
||||||
|
|
||||||
CIRCUITPY_NVM = 1
|
CIRCUITPY_NVM = 1
|
||||||
|
CIRCUITPY_BLEIO_HCI = 0
|
||||||
|
|
||||||
MCU_SERIES = F4
|
MCU_SERIES = F4
|
||||||
MCU_VARIANT = STM32F411xE
|
MCU_VARIANT = STM32F411xE
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#ifdef MICROPY_HW_NEOPIXEL
|
#ifdef MICROPY_HW_NEOPIXEL
|
||||||
bool neopixel_in_use;
|
bool neopixel_in_use;
|
||||||
#endif
|
#endif
|
||||||
#ifdef MICROPY_HW_APA102_MOSI
|
#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)
|
||||||
bool apa102_sck_in_use;
|
bool apa102_sck_in_use;
|
||||||
bool apa102_mosi_in_use;
|
bool apa102_mosi_in_use;
|
||||||
#endif
|
#endif
|
||||||
@ -70,7 +70,7 @@ void reset_all_pins(void) {
|
|||||||
#ifdef MICROPY_HW_NEOPIXEL
|
#ifdef MICROPY_HW_NEOPIXEL
|
||||||
neopixel_in_use = false;
|
neopixel_in_use = false;
|
||||||
#endif
|
#endif
|
||||||
#ifdef MICROPY_HW_APA102_MOSI
|
#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)
|
||||||
apa102_sck_in_use = false;
|
apa102_sck_in_use = false;
|
||||||
apa102_mosi_in_use = false;
|
apa102_mosi_in_use = false;
|
||||||
#endif
|
#endif
|
||||||
@ -97,8 +97,11 @@ void reset_pin_number(uint8_t pin_port, uint8_t pin_number) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef MICROPY_HW_APA102_MOSI
|
#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)
|
||||||
if ((pin_port == MICROPY_HW_APA102_MOSI->port && pin_number == MICROPY_HW_APA102_MOSI->number) || (pin_port == MICROPY_HW_APA102_SCK->port && pin_number == MICROPY_HW_APA102_MOSI->number))
|
if (
|
||||||
|
(pin_port == MICROPY_HW_APA102_MOSI->port && pin_number == MICROPY_HW_APA102_MOSI->number)
|
||||||
|
|| (pin_port == MICROPY_HW_APA102_SCK->port && pin_number == MICROPY_HW_APA102_MOSI->number)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
apa102_mosi_in_use = false;
|
apa102_mosi_in_use = false;
|
||||||
apa102_sck_in_use = false;
|
apa102_sck_in_use = false;
|
||||||
@ -140,7 +143,7 @@ bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) {
|
|||||||
return !neopixel_in_use;
|
return !neopixel_in_use;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef MICROPY_HW_APA102_MOSI
|
#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)
|
||||||
if (pin == MICROPY_HW_APA102_MOSI)
|
if (pin == MICROPY_HW_APA102_MOSI)
|
||||||
{
|
{
|
||||||
return !apa102_mosi_in_use;
|
return !apa102_mosi_in_use;
|
||||||
@ -173,7 +176,7 @@ void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) {
|
|||||||
neopixel_in_use = true;
|
neopixel_in_use = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef MICROPY_HW_APA102_MOSI
|
#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)
|
||||||
if (pin == MICROPY_HW_APA102_MOSI)
|
if (pin == MICROPY_HW_APA102_MOSI)
|
||||||
{
|
{
|
||||||
apa102_mosi_in_use = true;
|
apa102_mosi_in_use = true;
|
||||||
|
@ -48,7 +48,7 @@ bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self,
|
|||||||
|
|
||||||
// Erase flash sector
|
// Erase flash sector
|
||||||
HAL_FLASH_Unlock();
|
HAL_FLASH_Unlock();
|
||||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGSERR );
|
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR );
|
||||||
FLASH_Erase_Sector(CIRCUITPY_INTERNAL_NVM_SECTOR, VOLTAGE_RANGE_3);
|
FLASH_Erase_Sector(CIRCUITPY_INTERNAL_NVM_SECTOR, VOLTAGE_RANGE_3);
|
||||||
|
|
||||||
// Write bytes to flash
|
// Write bytes to flash
|
||||||
|
Loading…
x
Reference in New Issue
Block a user