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

Write Enable instruction execution #3

Open
escherstair opened this issue Oct 20, 2022 · 0 comments
Open

Write Enable instruction execution #3

escherstair opened this issue Oct 20, 2022 · 0 comments
Assignees

Comments

@escherstair
Copy link

From M95M01 datasheet, in paragraph 6.4 I read

The Write Status Register (WRSR) instruction is used to write new values to the Status
Register. Before it can be accepted, a Write Enable (WREN) instruction must have been
previously executed.

and in parapgraph 6.1

The Write Enable Latch (WEL) bit must be set prior to each WRITE and WRSR instruction.
The only way to do this is to send a Write Enable instruction to the device.
As shown in Figure 8, to send this instruction to the device, Chip Select (S) is driven low,
and the bits of the instruction byte are shifted in, on Serial Data Input (D). The device then
enters a wait state. It waits for the device to be deselected by Chip Select (S) being driven
high.

And so I assume that to complete a Write Enable instruction, the Chip Select (S) must be driven high.

In file eeprma1_m95.c I see two different approaches:

if ( EEPRMA1_M95_WriteCmd( EEPROMEX_WREN, DevAddr ) != BSP_ERROR_NONE )

calls EPRMA1_M95_WriteCmd() taht internally sets Chip Select low and then high.

On the other side, the following call

if ( EEPRMA1_M95_IOWrite( EEPROMEX_WREN ) != BSP_ERROR_NONE )

doesn't handle Chip Select, which is driven low by the previous function
EEPROMEX_CTRL_LOW( Devaddr & EEPROMEX_SPI_SLAVESEL );

but it's not driven high before the following call to EEPRMA1_M95_IOWrite( EEPROMEX_WRSR )
if (EEPRMA1_M95_IOWrite( EEPROMEX_WRSR ) != BSP_ERROR_NONE )

Can someone from ST verify this difference, please?
Which is the right way to send a Write Enable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants