Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

SFLASH support addition in WICED

SFLASH support addition in WICED

RaktimR_11
Moderator
Moderator
Moderator
500 replies posted 250 replies posted 100 replies posted

WICED currently has support for sflash from the following manufacturers.

  1. MACRONIX
  2. MICRON
  3. SST
  4. EON
  5. ISSI
  6. WINBOND
  7. CYPRESS

You can get a list of all the supported sflash in CYW43907 with External SFLASH in WICED . If you want to add support for any other part number from the existing supported flash manufacturers in WICED SDK, you can follow the steps mentioned below. In this example, I have added support for N25Q128A flash from MICRON.

 

For ST based platforms:

  • Please add the SFLASH_ID from the part number datasheet in 43xxx_Wi-Fi/libraries/drivers/spi_flash/spi_flash_internal.h

    #define SFLASH_ID_MX25L8006E           ( (uint32_t) 0xC22014 )

    #define SFLASH_ID_MX25L1606E           ( (uint32_t) 0xC22015 )

    #define SFLASH_ID_MX25L6433F           ( (uint32_t) 0xC22017 )

    #define SFLASH_ID_MX25L12835F          ( (uint32_t) 0xC22018 )

    #define SFLASH_ID_MX25L25635F          ( (uint32_t) 0xC22019 )

    #define SFLASH_ID_MX25U1635F           ( (uint32_t) 0xC22535 )

    #define SFLASH_ID_MX66U51235F          ( (uint32_t) 0xC2253A )

    #define SFLASH_ID_SST25VF080B          ( (uint32_t) 0xBF258E )

    #define SFLASH_ID_EN25QH16             ( (uint32_t) 0x1C3015 )

    #define SFLASH_ID_ISSI25CQ032          ( (uint32_t) 0x7F9D46 )

    #define SFLASH_ID_N25Q512A             ( (uint32_t) 0x20BB20 )

    #define SFLASH_ID_ISSI25LP064          ( (uint32_t) 0x9D6017 )

    #define SFLASH_ID_N25Q064A             ( (uint32_t) 0x20BA17 )

    #define SFLASH_ID_W25Q64FV             ( (uint32_t) 0xEF4017 )

    #define SFLASH_ID_CY15B104Q            ( (uint32_t) 0x7F7F7F )

    +#define SFLASH_ID_N25Q128A             ( (uint32_t) 0x20BA18 )

 

    #define SFLASH_ID_DEFAULT              ( (uint32_t) 0x000000 )

 

  • Then try adding the size of the new part number in 43xxx_Wi-Fi/libraries/drivers/spi_flash/spi_flash_internal.h

 

   #define SFLASH_SIZE_1MByte                0x100000

   #define SFLASH_SIZE_2MByte                0x200000

   #define SLFASH_SIZE_32MByte               0x2000000

   #define SFLASH_SIZE_64MByte               0x4000000

   #define SFLASH_SIZE_512KByte              0x80000

   #define SFLASH_SIZE_16MByte               0x1000000

 

  • Add the device name in the sflash_device_id_size structure in the following manner

 

         device_id_to_flash_size_t sflash_device_id_size [SFLASH_ID_MAX_PARTS] =

         {

                { SFLASH_ID_MX25L8006E,  SFLASH_SIZE_1MByte   },

                { SFLASH_ID_MX25L1606E,  SFLASH_SIZE_2MByte   },

                { SFLASH_ID_MX25L25635F, SLFASH_SIZE_32MByte  },

                { SFLASH_ID_MX25U1635F,  SFLASH_SIZE_2MByte   },

                { SFLASH_ID_SST25VF080B, SFLASH_SIZE_1MByte   },

                { SFLASH_ID_EN25QH16,    SFLASH_SIZE_2MByte   },

                { SFLASH_ID_N25Q512A,    SFLASH_SIZE_64MByte  },

                { SFLASH_ID_CY15B104Q,   SFLASH_SIZE_512KByte },

                { SFLASH_ID_N25Q128A,    SFLASH_SIZE_16MByte  }

 

         };

 

  • If you are using WINBOND, ISSI, CYPRESS flash, you have to add SFLASH_SUPPORT_WINBOND_PARTS in 43xxx_Wi-Fi/libraries/drivers/spi_flash/spi_flash.mk or as a part of GLOBAL_DEFINES in your <platform>.mk file

 

 

For 4390x based platform

 

To add a new part with the already supported sflash chips for 4390x platform, you have to make the necessary modifications in 43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/peripherals/spi_flash.

 

  • Just like ST based platforms, you need to add the SFLASH_ID in 43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/peripherals/spi_flash/spi_flash.h

 

      #define SFLASH_ID_MX25L8006E           SFLASHID( 0xC2, 0x20, 0x14 )

 

      #define SFLASH_ID_MX25L1606E           SFLASHID( 0xC2, 0x20, 0x15 )

 

      #define SFLASH_ID_MX25L6433F           SFLASHID( 0xC2, 0x20, 0x17 )

 

      #define SFLASH_ID_MX25L12835F          SFLASHID( 0xC2, 0x20, 0x18 )

 

      #define SFLASH_ID_MX25L25635F          SFLASHID( 0xC2, 0x20, 0x19 )

 

      #define SFLASH_ID_MX25U1635F           SFLASHID( 0xC2, 0x25, 0x35 )

 

      #define SFLASH_ID_MX66U51235F          SFLASHID( 0xC2, 0x25, 0x3A )

 

      #define SFLASH_ID_SST25VF080B          SFLASHID( 0xBF, 0x25, 0x8E )

 

      #define SFLASH_ID_EN25QH16             SFLASHID( 0x1C, 0x30, 0x15 )

 

      #define SFLASH_ID_ISSI25CQ032          SFLASHID( 0x7F, 0x9D, 0x46 )

 

      #define SFLASH_ID_N25Q512A             SFLASHID( 0x20, 0xBB, 0x20 )

 

      #define SFLASH_ID_ISSI25LP064          SFLASHID( 0x9D, 0x60, 0x17 )

 

      #define SFLASH_ID_N25Q064A             SFLASHID( 0x20, 0xBA, 0x17 )

 

      #define SFLASH_ID_W25Q64FV             SFLASHID( 0xEF, 0x40, 0x17 )

 

      #define SFLASH_ID_S25FL064L            SFLASHID( 0x01, 0x60, 0x17 )

 

      #define SFLASH_ID_S25FL128L            SFLASHID( 0x01, 0x60, 0x18 )

 

      #define SFLASH_ID_S25FL256L            SFLASHID( 0x01, 0x60, 0x19 )

 

      #define SFLASH_ID_N25Q128A             SFLASHID( 0x20, 0xBA, 0x18 )

 

      #define SFLASH_ID_DEFAULT              SFLASHID( 0x00, 0x00, 0x00 )

 

                  

  • In 43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/peripherals/spi_flash/spi_flash.c, you have to add the part number information in sflash_capabilities_tables structure.

       #ifdef SFLASH_SUPPORT_MICRON_PARTS

              { SFLASH_ID_N25Q064A,       { 8*MBYTE,    256,  .action = &micron_action,   .speed_advance = &micron_speed_config } },

              { SFLASH_ID_N25Q128A,       { 16*MBYTE,   256,  .action = &micron_action,   .speed_advance = &micron_speed_config } },

      #endif

  •      If you are using any flash other than macronix flash, you have to add support in <platform_name>.mk file in the following manner.

             GLOBAL_DEFINES += SFLASH_SUPPORT_MICRON_PARTS

 

Debugging Notes:

  • Please check for DEBUG_PRINT macro in 43xxx_Wi-Fi/apps/waf/sflash_write/sflash_write.c. Once you enable this macro, you should be able to see debug prints in the UART terminal where you should look for SFLASH ID and SFLASH size. If the support is correctly added, these two fields will show you the correct SFLASH ID and the size that you have added following the above mentioned steps.


          SFLASH Device ID ( 0x20ba18)
     SFLASH Size      ( 0x1000000)

  • The micron flash (N25Q128A) I have added in this example needed a 100k pull up resistor in the RESET pin as specified by the datasheet. Please check similar things in the datasheet of the flash you plan to add.
  • This blog post does not cover the porting effort of flash from a different manufacturer, in which case, you have to add the read, write, erase source code in the spi_flash.c for which you can refer to the already existing implementations.
2054 Views