IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

MPLAB Discussion :

flash externe SST26VT064B


Sujet :

MPLAB

  1. #1
    Membre du Club
    Homme Profil pro
    Electronicien
    Inscrit en
    Août 2008
    Messages
    360
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Electronicien
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2008
    Messages : 360
    Points : 53
    Points
    53
    Par défaut flash externe SST26VT064B
    Je programme sous MPLAB IDE v3.26 x
    harmonie v1_07_01

    J'utilise un exemple de soft de chez microchip "pic32_eth_wifi_web_server .X"
    et le BSP (pic32mx_eth_sk) que j'ai changé pour mon besoin.

    quelqu'un aurait déjà utilisé ces mémoire flash avec le pic32mx795f512l ?
    Et aurait-il des sources de programme utilisé pour initiécrire et lire en SPI

    Merci de votre aide

  2. #2
    Membre du Club
    Homme Profil pro
    Electronicien
    Inscrit en
    Août 2008
    Messages
    360
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Electronicien
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2008
    Messages : 360
    Points : 53
    Points
    53
    Par défaut
    apparement , je dois être le seul au monde à utiliser ces flash, microchip va pas en vendre beaucoup si ils compte sur moi

  3. #3
    Membre du Club
    Homme Profil pro
    Electronicien
    Inscrit en
    Août 2008
    Messages
    360
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Electronicien
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2008
    Messages : 360
    Points : 53
    Points
    53
    Par défaut
    bonjour à tous,

    J'essai d'utiliser ma flash externe SST26VF064B avec mon micro PIC32MX795F512L.
    http://ww1.microchip.com/downloads/e.../20005119G.pdf

    Je m'inspire des fonctions données sur ce lien : http://ww1.microchip.com/downloads/e...ST26VF064B.zip
    Je comprend pas tout ce que ça fait, mais une vague idée pour le moment de certaine fonction

    Code c : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    /* ************************************************************************** */
    #include "system_definitions.h"
    #include "my_spi_pic32.h"
    /* ************************************************************************** */
    /* ************************************************************************** */
    /* Section: Included Files                                                    */
    /* ************************************************************************** */
    /* ************************************************************************** */
     
    /* This section lists the other files that are included in this file.
     */
     
    /* TODO:  Include other files here if needed. */
     
    unsigned int data_256[256];	/* global array to store read data */
    unsigned int block_protection_18[18];	/* global array to store block_protection data */
    unsigned char   Manufacturer_Id, Device_Type, Device_Id; /* global array to store Manufacturer and Device id information */
     
    /* ************************************************************************** */
    /* ************************************************************************** */
    /* Section: File Scope or Global Data                                         */
    /* ************************************************************************** */
    /* ************************************************************************** */
     
    /*  A brief description of a section can be given directly below the section
        banner.
     */
     
    /* ************************************************************************** */
    /** Descriptive Data Item Name
     
      @Summary
        Brief one-line summary of the data item.
        
      @Description
        Full description, explaining the purpose and usage of data item.
        <p>
        Additional description in consecutive paragraphs separated by HTML 
        paragraph breaks, as necessary.
        <p>
        Type "JavaDoc" in the "How Do I?" IDE toolbar for more information on tags.
        
      @Remarks
        Any additional remarks
     */
    int global_data;
     
    // internal type definition
    typedef union
    {
        struct
        {
            uint8_t uint8Address[4];
        };
     
        uint32_t uint32Address;
    } SST26_ADDRESS;
     
     
    /************************************************************************/
    /* PROCEDURE:	Page_Program						*/
    /*									*/
    /* This procedure does page programming.  The destination               */
    /* address should be provided.                                  	*/
    /* The data array of 256 bytes contains the data to be programmed.      */
    /* Since the size of the data array is 256 bytes rather than 256 bytes, this page program*/
    /* procedure programs only 256 bytes                                    */
    /* Assumption:  Address being programmed is already erased and is NOT	*/
    /*		block protected.					*/
    /* Input:								*/
    /*		Dst:		Destination Address 000000H - 7FFFFFH	*/
    /*		data_256[256] containing 256 bytes of data will be programmed using this function */
    /************************************************************************/
     
    void APP_SPI_CS_SELECT(void)
    {
     CS1_SPI=0;   
     
    }
     
    void APP_SPI_CS_DESELECT(void)
    {
       CS1_SPI=1; 
     
    }
     
    void APP_SPI_CS2_SELECT(void)
    {
     CS2_SPI=0;   
     
    }
     
    void APP_SPI_CS2_DESELECT(void)
    {
       CS2_SPI=1; 
     
    }
     
    void Reset1_Hold_Low()
    {
        RST1_FLASH=0;
     
    }
     
    void Reset1_Hold_High()
    {
        RST1_FLASH=1;
     
    }
     
    void Reset2_Hold_Low()
    {
        RST2_FLASH=0;
     
    }
     
    void Reset2_Hold_High()
    {
        RST2_FLASH=1;
     
    }
     
     
    void WP1_Low()
    {
        WP1_FLASH=0;
    }
     
     
    void WP1_High()
    {
        WP1_FLASH=1;
    }
     
    void WP2_Low()
    {
        WP2_FLASH=0;
    }
     
     
    void WP2_High()
    {
        WP2_FLASH=1;
    }
     
     
     
     
    void SPI_Page_Program(unsigned long Dst)
    {
    	unsigned int i;
    	i=0;
     
     
        APP_SPI_CS_SELECT();
        DRV_SPI_Put(0x02);
        DRV_SPI_Put(((Dst & 0xFFFFFF) >> 16));
        DRV_SPI_Put(((Dst & 0xFFFF) >> 8));
        DRV_SPI_Put(Dst & 0xFF);
     
    	for (i=0;i<256;i++)
    	{	DRV_SPI_Put(data_256[i]);		/* send byte to be programmed */
    	}
    	APP_SPI_CS_DESELECT();			/* disable device */
    }
     
     
    /************************************************************************/
    /* PROCEDURE: Read_Status_Register					*/
    /*									*/
    /* This procedure reads the status register and returns the byte.	*/
    /************************************************************************/
     
     
    unsigned char SPI_Read_Status_Register()
    {
    	unsigned char byte = 0;
    	APP_SPI_CS_SELECT();/* enable device */
        DRV_SPI_Put(0x05);
    	//Send_Byte(0x05);		/* send RDSR command */
    	byte = DRV_SPI_read();		/* receive byte */
    	APP_SPI_CS_DESELECT();			/* disable device */
    	return byte;
    }
     
    /************************************************************************/
    /* PROCEDURE: WREN							*/
    /*									*/
    /* This procedure enables the Write Enable Latch.               	*/
    /************************************************************************/
     
     
    void SPI_WREN()
    {
    	//APP_SPI_CS_SELECT();/* enable device */
        DRV_SPI_Put(0x06);
    	//Send_Byte(0x06);		/* send WREN command */
    	//APP_SPI_CS_DESELECT();			/* disable device */
    }
     
     
    /************************************************************************/
    /* PROCEDURE: WRDI							*/
    /*									*/
    /* This procedure disables the Write Enable Latch.			*/
    /************************************************************************/
     
    void SPI_WRDI()
    {
    	//APP_SPI_CS_SELECT();/* enable device */
        DRV_SPI_Put(0x04);
    	//Send_Byte(0x04);		/* send WRDI command */
    	//APP_SPI_CS_DESELECT();			/* disable device */
    }
     
     
    /************************************************************************/
    /* PROCEDURE: QuadJ_ID							*/
    /*									*/
    /* This procedure Reads the manufacturer's ID, device Type and device ID.  It will 	*/
    /* use AFh as the command to read the ID.                               */
    /* Returns:								*/
    /*	ID1(Manufacture's ID = BFh, Device Type =26h , Device ID = 02h)	*/
    /*									*/
    /************************************************************************/
     
     
    void Jedec_ID_Read()
    {
     
     
    	//APP_SPI_CS_SELECT();/* enable device */
        DRV_SPI_Put(0x9F);
        //DRV_SPI_Put(0x9F);
        //DRV_SPI_Put(0x9F);
     
     
        Manufacturer_Id = DRV_SPI_read();
        Device_Type = DRV_SPI_read();
        Device_Id = DRV_SPI_read();
     
     
        Manufacturer_flash=Manufacturer_Id;
        Device_type_flash=Device_Type;
        Device_Id_flash=Device_Id;
     
     
     
    }


    Actuellement j'arrive à communiquer tant bien que mal ; j'ai testé le JEDEC et reçois les données d’identification comme tel :

    par cette fonction :

    Code c : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    void Jedec_ID_Read()
    {
     
        DRV_SPI_Put(0x9F);
     
        Manufacturer_Id = DRV_SPI_read();
        Device_Type = DRV_SPI_read();
        Device_Id = DRV_SPI_read();
     
     
        Manufacturer_flash=Manufacturer_Id;
        Device_type_flash=Device_Type;
        Device_Id_flash=Device_Id;
     
     
    }

    le truc est que je ne reçois pas les valeur dans l'ordre d'envoi et pas toujours à la valeur correspondante :

    La ou je dois avoir :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
       Manufacturer_flash=BF
        Device_type_flash=26
        Device_Id_flash=43
    J'ai parfois :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
       Manufacturer_flash=BF
        Device_type_flash=43
        Device_Id_flash=43
    ou

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
       Manufacturer_flash=BF
        Device_type_flash=BF
        Device_Id_flash=26
    Evidemment, l'objectif final est de pouvoir sauvegarder mes valeurs à l'extinction de mon appareil

Discussions similaires

  1. [Flash Pascal] Pas de Bug Hello world avec flash externe
    Par joreveur dans le forum Flash Pascal
    Réponses: 8
    Dernier message: 24/10/2013, 22h28
  2. import flash.external.ExternalInterface
    Par xerel dans le forum ActionScript 3
    Réponses: 0
    Dernier message: 22/07/2010, 17h08
  3. [FLASH MX] Scrollbar et contenu Html externe
    Par efrenik dans le forum Flash
    Réponses: 9
    Dernier message: 21/08/2006, 16h39
  4. Réponses: 10
    Dernier message: 29/10/2004, 18h45
  5. [FLASH MX] Pb chargement d'un txt externe
    Par proutcore dans le forum Flash
    Réponses: 8
    Dernier message: 28/09/2004, 16h15

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo