Skip to main content
-----????_---- ---??as
Associate II
August 15, 2017
Question

Sector Codes Can Bootloader

Posted on August 15, 2017 at 18:00

According to AN3154 Datasheet I must write sector code in data field.But I dont know what is sector code and How can i find it for stm32f4 discovery?Just I want to erase sector by sector what I must do?(I know I must write stdid=>0x43 dlc=>? data=?)

    This topic has been closed for replies.

    2 replies

    STOne-32
    ST Technical Moderator
    August 15, 2017
    Posted on August 15, 2017 at 19:21

    Hi,

    Sector code is the number of the sectors , for example if you want to Erase 4 first sectors, you need to send the their numbers : 0 , 1 , 2, 3.  as in our Reference Manual for STM32F405/407 of that discovery RM0090.

    Check also if it is an Erase 0x43  or Extended Erase 0x44 in AN2606/AN3154.

    Cheers,

    STOne-32.

    -----????_---- ---??as
    Associate II
    August 16, 2017
    Posted on August 16, 2017 at 09:47

    I write like this to erase 4 first sectors but not working...

    hcan.pTxMsg->StdId = 0x43;

    hcan.pTxMsg->RTR = CAN_RTR_DATA;

    hcan.pTxMsg->IDE = CAN_ID_STD;

    hcan.pTxMsg->DLC = 4;

    hcan.pTxMsg->Data[0] = 0x00;

    hcan.pTxMsg->Data[1] = 0x01;

    hcan.pTxMsg->Data[2] = 0x02;

    hcan.pTxMsg->Data[3] = 0x03;

    HAL_CAN_Transmit(&hcan, 10);