Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FLASH Add W25M homogeneous stack driver and W25M512 support #5722

Merged
merged 2 commits into from
Apr 20, 2018

Conversation

jflyper
Copy link
Contributor

@jflyper jflyper commented Apr 19, 2018

The homogeneous stack driver provides support for Winbond W25M series spistack flash chips that are stacks of same sized dies.

W25M512JV ( = 2 x W25Q256JV )
https://www.winbond.com/resource-files/w25m512jv%20revc%2001062017.pdf

Note:
Support for W25M02G will be provided by the W25M homogeneous mode driver once W25N01G is added.

int dieNumber = address / dieSize;
uint32_t dieAddress = address % dieSize;

if (dieAddress + rlen > dieSize) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably rewrite this to:
tlen = MIN(dieAddress + rlen, dieSize) - dieAddress

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me try that!

DieHertz
DieHertz previously approved these changes Apr 19, 2018
@DieHertz
Copy link
Member

@jflyper What chip package you were using for your development? I thought there was one pin compatible with one of existing NOR chips used on FCs.

rbytes = dieDevice[dieNumber].vTable->readBytes(&dieDevice[dieNumber], dieAddress, buffer, tlen);

if (!rbytes) {
debug[0]++;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will have to be changed to use DEBUG_SET() or removed, or else it will break other debug modes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops...


#include "pg/flash.h"

#define W25M_INSTRUCTION_SOFTWARE_DIE_SELECT 0xC2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unaligned spacing.

for (rlen = length; rlen; rlen -= tlen) {
int dieNumber = address / dieSize;
uint32_t dieAddress = address % dieSize;
tlen = MIN(dieAddress + rlen, dieSize) - dieAddress
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now this needs to include common/maths.h.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouch!!! (And a semi-colon...)

@mikeller mikeller merged commit 0306acc into betaflight:master Apr 20, 2018
@jflyper jflyper deleted the bfdev-w25m512-support branch April 20, 2018 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants