I have just purchased the Flash3 Click and went to download the library, but there is only ones for MicroC and not Mikrobasic.
Does the Flash library that comes with Mikrobasic compiler work with the Flash3 Click or do I have write my own routines?
Cheers
Sean
Library for Flash3 Click
- darko.ilijevski
- Posts: 581
- Joined: 21 Mar 2017 16:57
Re: Library for Flash3 Click
Hello,
Sadly the libraries written for the mikroC won't work for mikroBASIC, as soon as the basic example is finished, I will post the information here.
Thanks for the patience and best regards
Sadly the libraries written for the mikroC won't work for mikroBASIC, as soon as the basic example is finished, I will post the information here.
Thanks for the patience and best regards
BR,
Darko
Darko
Re: Library for Flash3 Click
Hi Darko
I also have the Flash Click with the EN25Q80B 8mb memory for testing which there are examples for MikroBasic.
And after playing around, I managed to get the example code for the Flash Click working okay on the Flash3 Click
Here some notes that may help others.
Before moving onto the Flash3 Click, I wanted to get the Flash Click working.
The Flash Click I tested first and it is worth noting that in the examples the Flash_driver.mbas has the sector erase instruction wrong.
It is set to a Block Erase rather than a Sector Erase
It should read
Also I am already using SPI1 and SPI2 for other add-ons and so only had SPI3 left on the STM32F415RG
I tried using the
Which is meant to direct the pointers
To SPI3, but it did not work.
I replaced each instance of these pointers to
And it then kicked in and I was able to erase each sector of 4096 bytes and write/read back.
Then I moved onto the Flash3 Click that has the IS25LP128 128mb memory.
There is a lot more instructions defined in the MicroC flash_3_hw.h file but the basic ones for Write Enable, Page Program and Read were the same values as in the Flash Click example.
One thing that seemed to be different when reading the datasheet was the Sector Erase instruction.
It shows it as D7h/20h and on further investigation it seems that this is based on whether you are using Normal SPI or protocol or the QPI protocol.
SPI = D7h
QPI = 20h
So I set it to
This sort of now worked but data was a bit corrupt in places so I slowed down the SPI3 clock and it got a lot better.
At the moment I have wires linking the Click boards and suspect the 25LP128 chip is more sensitive to interference than the 25Q80.
Will see how it works when I get them down on a PCB.
Cheers
Sean
I also have the Flash Click with the EN25Q80B 8mb memory for testing which there are examples for MikroBasic.
And after playing around, I managed to get the example code for the Flash Click working okay on the Flash3 Click
Here some notes that may help others.
Before moving onto the Flash3 Click, I wanted to get the Flash Click working.
The Flash Click I tested first and it is worth noting that in the examples the Flash_driver.mbas has the sector erase instruction wrong.
It is set to a Block Erase rather than a Sector Erase
Code: Select all
const _SERIAL_FLASH_CMD_SER = 0xD8 ' 25Q80
Code: Select all
const _SERIAL_FLASH_CMD_SER = 0x20 ' 25Q80
I tried using the
Code: Select all
SPI_Set_Active(@SPI3_Read, @SPI3_Write)
Code: Select all
SPI_Wr_Ptr
SPI_Rd_Ptr
I replaced each instance of these pointers to
Code: Select all
SPI3_write
SPI3_read
Then I moved onto the Flash3 Click that has the IS25LP128 128mb memory.
There is a lot more instructions defined in the MicroC flash_3_hw.h file but the basic ones for Write Enable, Page Program and Read were the same values as in the Flash Click example.
One thing that seemed to be different when reading the datasheet was the Sector Erase instruction.
It shows it as D7h/20h and on further investigation it seems that this is based on whether you are using Normal SPI or protocol or the QPI protocol.
SPI = D7h
QPI = 20h
So I set it to
Code: Select all
const _SERIAL_FLASH_CMD_SER = 0xD7 ' 25LP128
At the moment I have wires linking the Click boards and suspect the 25LP128 chip is more sensitive to interference than the 25Q80.
Will see how it works when I get them down on a PCB.
Cheers
Sean
- darko.ilijevski
- Posts: 581
- Joined: 21 Mar 2017 16:57
Re: Library for Flash3 Click
Hello,
That is a great find, basically all the modules use the same SPI communication, minor differences as flash modes, block sizes, registers and commands need to be fixed for the specific chip, but basically the base structure of the example should work with any chip of this type. Anyway I will look forward to hear from you about if you managed to get your board working without errors.
Kind regards
That is a great find, basically all the modules use the same SPI communication, minor differences as flash modes, block sizes, registers and commands need to be fixed for the specific chip, but basically the base structure of the example should work with any chip of this type. Anyway I will look forward to hear from you about if you managed to get your board working without errors.
Kind regards
BR,
Darko
Darko