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
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#define MICROPY_HW_BOARD_NAME "THUNDERPACK"
|
||||
#define MICROPY_HW_BOARD_NAME "THUNDERPACK_v11"
|
||||
#define MICROPY_HW_MCU_NAME "STM32F411CE"
|
||||
|
||||
// Non-volatile memory config
|
||||
|
@ -27,17 +27,16 @@
|
||||
#define MICROPY_HW_MCU_NAME "STM32F411CE"
|
||||
|
||||
// Non-volatile memory config
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE (0x4000)
|
||||
#define CIRCUITPY_INTERNAL_NVM_START_ADDR (0x0800C000)
|
||||
#define CIRCUITPY_INTERNAL_NVM_SECTOR FLASH_SECTOR_3
|
||||
#define NVM_BYTEARRAY_BUFFER_SIZE 512
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE (0x4000)
|
||||
#define CIRCUITPY_INTERNAL_NVM_START_ADDR (0x0800C000)
|
||||
#define CIRCUITPY_INTERNAL_NVM_SECTOR FLASH_SECTOR_3
|
||||
#define NVM_BYTEARRAY_BUFFER_SIZE 512
|
||||
|
||||
// Flash config
|
||||
#define FLASH_SIZE (0x80000)
|
||||
#define FLASH_PAGE_SIZE (0x4000)
|
||||
#define BOARD_FLASH_SIZE (FLASH_SIZE - CIRCUITPY_INTERNAL_NVM_SIZE- 0x2000 - 0xC000)
|
||||
#define FLASH_SIZE (0x80000)
|
||||
#define FLASH_PAGE_SIZE (0x4000)
|
||||
#define BOARD_FLASH_SIZE (FLASH_SIZE - CIRCUITPY_INTERNAL_NVM_SIZE- 0x2000 - 0xC000)
|
||||
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0x8000
|
||||
#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000
|
||||
|
||||
// On-board flash
|
||||
#define SPI_FLASH_MOSI_PIN (&pin_PB15)
|
||||
@ -45,15 +44,14 @@
|
||||
#define SPI_FLASH_SCK_PIN (&pin_PB13)
|
||||
#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
|
||||
#define MICROPY_HW_APA102_MOSI (&pin_PB08)
|
||||
#define MICROPY_HW_APA102_SCK (&pin_PB00)
|
||||
|
||||
// I2C
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PB06)
|
||||
#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
|
||||
|
||||
CIRCUITPY_NVM = 1
|
||||
CIRCUITPY_BLEIO_HCI = 0
|
||||
|
||||
MCU_SERIES = F4
|
||||
MCU_VARIANT = STM32F411xE
|
||||
|
@ -35,7 +35,7 @@
|
||||
#ifdef MICROPY_HW_NEOPIXEL
|
||||
bool neopixel_in_use;
|
||||
#endif
|
||||
#ifdef MICROPY_HW_APA102_MOSI
|
||||
#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)
|
||||
bool apa102_sck_in_use;
|
||||
bool apa102_mosi_in_use;
|
||||
#endif
|
||||
@ -70,7 +70,7 @@ void reset_all_pins(void) {
|
||||
#ifdef MICROPY_HW_NEOPIXEL
|
||||
neopixel_in_use = false;
|
||||
#endif
|
||||
#ifdef MICROPY_HW_APA102_MOSI
|
||||
#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)
|
||||
apa102_sck_in_use = false;
|
||||
apa102_mosi_in_use = false;
|
||||
#endif
|
||||
@ -97,8 +97,11 @@ void reset_pin_number(uint8_t pin_port, uint8_t pin_number) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifdef MICROPY_HW_APA102_MOSI
|
||||
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 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)
|
||||
)
|
||||
{
|
||||
apa102_mosi_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;
|
||||
}
|
||||
#endif
|
||||
#ifdef MICROPY_HW_APA102_MOSI
|
||||
#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)
|
||||
if (pin == MICROPY_HW_APA102_MOSI)
|
||||
{
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
#ifdef MICROPY_HW_APA102_MOSI
|
||||
#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)
|
||||
if (pin == MICROPY_HW_APA102_MOSI)
|
||||
{
|
||||
apa102_mosi_in_use = true;
|
||||
|
@ -48,7 +48,7 @@ bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self,
|
||||
|
||||
// Erase flash sector
|
||||
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);
|
||||
|
||||
// Write bytes to flash
|
||||
|
@ -42,10 +42,10 @@
|
||||
#ifdef STM32F411xE
|
||||
#define STM32_FLASH_SIZE 0x80000 //512KiB
|
||||
#ifndef INTERNAL_FLASH_FILESYSTEM_SIZE
|
||||
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0xC000 //48KiB
|
||||
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0xC000 //48KiB
|
||||
#endif
|
||||
#ifndef INTERNAL_FLASH_FILESYSTEM_START_ADDR
|
||||
#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000
|
||||
#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user