Adding SPI Flash support in DSPS peripheral code base

6 posts / 0 new
Last post
kqtrinh
Offline
Last seen:3 years 10 months ago
Joined:2016-08-24 00:17
Adding SPI Flash support in DSPS peripheral code base

First of all, I truly appreciate the awesome development support I receive thus far. You guys are a great awesome group and with that level of customer focus, The company is definitely doing something right.

I am beginning to integrate SPI flash support into DSPS sample source base. Our custom application requires flash read/write by the MCU after it has completely booted and running. What is the approach as I am not familiar to the Basic Kit HW?

By simply looking at user_periph_setup.c for both projects, there are a few overlap lines in periph_init(). My questions are:

1. Is there a doc that describes SPI flash and what are the associated registers to set it up for read/wrrite?
2. How do I add the spi.c and spi_flash.c driver to the DSPS project? I know all board drivers exist under sdk/platform/driver.

Thanks,
--Khai
Adding SPI Flash support in DSPS peripheral code base

Device:
kqtrinh
Offline
Last seen:3 years 10 months ago
Joined:2016-08-24 00:17
I dry run the spi_flash

I dry run the spi_flash project and obtained the following result:

************
* SPI TEST *
************

阅读SPI Flash第一个256字节……00 00 00 00 0000 00 00 00 0000 00 00 00 0000 00 00 00 0000 00 00 00 0000 00 00 00 0000 00 00 00 0000 00 00 00 0000 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Bytes Read: 0xFFFF

SPI flash JEDEC ID is FFFFFF

Performing Program Page...Page programmed. (FF)

阅读SPI Flash第一个256字节……00 00 00 00 0000 00 00 00 0000 00 00 00 0000 00 00 00 0000 00 00 00 0000 00 00 00 0000 00 00 00 0000 00 00 00 0000 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Bytes Read: 0xFFFF

Performing Sector Erase...Sector erased. (FF)

Performing 512 byte write...Data written. (FF)

Reading SPI Flash first 512 bytes...00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Bytes Read: 0xFFFF

End of test

在检查嗯- b - 014文档,然后实现e the 580 Basic Kit does not have Flash onboard. I am not sure if that was true as the document was quite old as it described a very old 14580 development kit that has JTAG dongle, a carrier board and a daughter card, etc...).

It then bags a question that does the Basic Kit I have has Flash onboard?
Does this UM-B-014 document still valid for today's basic kit?

Thanks,
--Khai

kqtrinh
Offline
Last seen:3 years 10 months ago
Joined:2016-08-24 00:17
If the 580 Basic Kit does not

If the 580 Basic Kit does not have Flash onboard, how then was I able to use SmartSnippets and click on the SPI Flash button to upload the DSPS FW to flash and was also able to erase flash before written to it? Please help me straighten things out.

Thanks,
--Khai

JE_Dialog
Offline
Last seen:51 min 32 sec ago
Staff
Joined:2013-12-05 14:02
Hi Khai,

Hi Khai,

UM-B-014 refers to the Expert kit which was the orignial kit we launched the DA14580: since then , we've superceeded that with the BASIC kit and Pro Kit. the BASIC kit / PRO Kits have FLASH device on the main board, whereas EXPERT kit doesnt.

check out the apps note below.. AN-B-023 describes how to interface to external memory (e.g. SPI flash). This covers the options for both BASIC and PRO kit, which should help you on your way and show you how to access the API's in SDK5 for the SPI flash.

https://support.dialog-semiconductor.com/resource/b-023-interfacing-da14...

Furthermore, section 10.10 of the software development guide below will show you how to work with the SPI flash driver.

https://support.dialog-semiconductor.com/resource/um-b-051-da14580-softw...

BR JE_Dialog

kqtrinh
Offline
Last seen:3 years 10 months ago
Joined:2016-08-24 00:17
If you can refer back to my

If you can refer back to my previous post about running the spi_flash sample code above resulted in everything 0s when reading flash. I believe the program created an array of 512 elements initialized it to (0...511) and write to flash and then read back. If the Basic Kit has flash on the main board, the read back should be valid. Please help...

Thanks,
--Khai

MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
Joined:2015-06-08 11:34
Hi kqtrinh,

Hi kqtrinh,

The basic kit has a flash on board, but you need to connect it via the appropriate jumpers, have you done that ? on the basic kit, just behind the J4 header there is a schematic that describes the connections that should be made in order to operate the basic kits on board flash.

Thanks MT_dialog