Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stm32_ir_feet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
humanoides
common
stm32_ir_feet
Commits
d72b1550
Commit
d72b1550
authored
7 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Solved a problem with the EPPROM leveling algorithm when transfering from one bank to the other.
parent
414bb5b5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/eeprom.h
+2
-2
2 additions, 2 deletions
include/eeprom.h
src/eeprom.c
+5
-4
5 additions, 4 deletions
src/eeprom.c
with
7 additions
and
6 deletions
include/eeprom.h
+
2
−
2
View file @
d72b1550
...
...
@@ -53,11 +53,11 @@
/* Pages 0 and 1 base and end addresses */
#define PAGE0_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 0x0000))
#define PAGE0_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + (PAGE_SIZE - 1)))
#define PAGE0_ID 0x08000
8
00
#define PAGE0_ID 0x08000
4
00
#define PAGE1_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 0x0400))
#define PAGE1_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 2*PAGE_SIZE - 1))
#define PAGE1_ID 0x0800
1
000
#define PAGE1_ID 0x08000
8
00
/* Used Flash pages for EEPROM emulation */
#define PAGE0 ((uint16_t)0x0000)
...
...
This diff is collapsed.
Click to expand it.
src/eeprom.c
+
5
−
4
View file @
d72b1550
...
...
@@ -637,7 +637,7 @@ static uint16_t EE_PageTransfer(uint16_t VirtAddress, uint16_t Data)
HAL_StatusTypeDef
flashstatus
=
HAL_OK
;
uint32_t
newpageaddress
=
EEPROM_START_ADDRESS
;
uint32_t
oldpageid
=
0
;
uint16_t
validpage
=
PAGE0
,
varidx
=
0
;
uint16_t
validpage
=
PAGE0
,
varidx
=
0
,
address
=
0
;
uint16_t
eepromstatus
=
0
,
readstatus
=
0
;
uint32_t
page_error
=
0
;
FLASH_EraseInitTypeDef
s_eraseinit
;
...
...
@@ -685,15 +685,16 @@ static uint16_t EE_PageTransfer(uint16_t VirtAddress, uint16_t Data)
/* Transfer process: transfer variables from old to the new active page */
for
(
varidx
=
0
;
varidx
<
EEPROM_NUM_VAR
;
varidx
++
)
{
if
(
eeprom_data
[
varidx
]
!=
VirtAddress
)
/* Check each variable except the one passed as parameter */
address
=
((
__IO
uint16_t
*
)
oldpageid
)[
1
+
varidx
*
2
];
if
(
address
!=
VirtAddress
)
/* Check each variable except the one passed as parameter */
{
/* Read the other last variable updates */
readstatus
=
EE_ReadVariable
(
eeprom_data
[
varidx
]
,
&
DataVar
);
readstatus
=
EE_ReadVariable
(
address
,
&
DataVar
);
/* In case variable corresponding to the virtual address was found */
if
(
readstatus
!=
0x1
)
{
/* Transfer the variable to the new active page */
eepromstatus
=
EE_VerifyPageFullWriteVariable
(
eeprom_data
[
varidx
]
,
DataVar
);
eepromstatus
=
EE_VerifyPageFullWriteVariable
(
address
,
DataVar
);
/* If program operation was failed, a Flash error code is returned */
if
(
eepromstatus
!=
HAL_OK
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment