piconomix / px-fwlib Goto Github PK
View Code? Open in Web Editor NEWopen source bare-metal C firmware and documentation for microcontrollers
License: Other
open source bare-metal C firmware and documentation for microcontrollers
License: Other
Greetings,
Basically I think I've identified a bug in px-log, when the log rolls round having filled all available sectors it erases the wrong sector, starts writing in that sector, and when it fills, logs a trace that the log is corrupt. I have verified that I am writing to the correct addresses in my memory device. I am using only 3 sectors, which is a bit small I suppose, but it makes for easier debugging. .
Target is ATMEGA2560.
The guts of px_log_fs_cfg.h is below:
#define PX_LOG_FS_CFG_PAGE_SIZE 256
#define PX_LOG_FS_CFG_ERASE_BLOCK_SIZE 16
#define PX_LOG_FS_CFG_REC_DATA_SIZE 6
#define PX_LOG_FS_CFG_STOP_WR_WHEN_FULL 0
init:
const px_log_fs_err_t rc = px_log_fs_init(&f_px_log_fs_handle, 0, 3 * PX_LOG_FS_CFG_ERASE_BLOCK_SIZE - 1);
write:
const px_log_fs_err_t rc = px_log_fs_wr(&f_px_log_fs_handle, rec, sizeof(driver_speed_log_record_t));
This is what happens:
log after init on an erased memory:
Page start: 0x0000
Page end: 0x002F
Page size: 256
Record size: 8
Record data size: 6
Records per page: 31
First page: 65535
Last page: 65535
Write p: 0x0000, 0x0004
Read p: 0x0000, 0x0000
0 1 2 3 4 5 6 7 8 9 A B C D E F
0x0000: x x x x x x x x x x x x x x x x
0x0010: x x x x x x x x x x x x x x x x
0x0020: x x x x x x x x x x x x x x x x
log after filling memory with records:
Page start: 0x0000
Page end: 0x002F
Page size: 256
Record size: 8
Record data size: 6
Records per page: 31
First page: 0
Last page: 47
Write p: 0x0000, 0x0004
Read p: 0x0000, 0x0000
0 1 2 3 4 5 6 7 8 9 A B C D E F
0x0000: U 0000 U 0001 U 0002 U 0003 U 0004 U 0005 U 0006 U 0007 U 0008 U 0009 U 000a U 000b U 000c U 000d U 000e U 000f
0x0010: U 0010 U 0011 U 0012 U 0013 U 0014 U 0015 U 0016 U 0017 U 0018 U 0019 U 001a U 001b U 001c U 001d U 001e U 001f
0x0020: U 0020 U 0021 U 0022 U 0023 U 0024 U 0025 U 0026 U 0027 U 0028 U 0029 U 002a U 002b U 002c U 002d U 002e U 002f
log after writing one more record:
Page start: 0x0000
Page end: 0x002F
Page size: 256
Record size: 8
Record data size: 6
Records per page: 31
First page: 0
Last page: 16
Write p: 0x0010, 0x000C
Read p: 0x0000, 0x0000
0 1 2 3 4 5 6 7 8 9 A B C D E F
0x0000: U 0000 U 0001 U 0002 U 0003 U 0004 U 0005 U 0006 U 0007 U 0008 U 0009 U 000a U 000b U 000c U 000d U 000e U 000f
0x0010: U 0030 x x x x x x x x x x x x x x x
0x0020: U 0020 U 0021 U 0022 U 0023 U 0024 U 0025 U 0026 U 0027 U 0028 U 0029 U 002a U 002b U 002c U 002d U 002e U 002f
After writing reet of sector plus ONE more record:
TRACE: 10,707: ERROR: File system must be corrupt (line no. in log-fs.c)
Hi, I came across your firmware library for the command line interface. It looks quite interesting and well coded.
One question has come to mind as I have pondered the implementation. Is there a way to interpret a command group as a command ?
Using your led [on | off] example, please let me explain. You have a "group" called "led" and two "commands" which are "on" and "off". What if the "led" group can have a third calling style that is the command "led"? For instance, you type "led" with no arguments and you want the cli to interpret this as a command to display the current state of the led. So,
"led on" - turns the led on
"led off" - turns the led off
"led" - displays the current state of the led
Is this functionality with the CLI library currently possible?
If you incorrectly type the second parameter and then press TAB the code gets stuck in an infinite loop. For example in the demo code on the PX-HER0 type
spi g
Adding a return false after line 551 in px_cli.c seems to fix this for me but I'm not sure this is the perfect answer
550 // Go back to start of list
551 px_cli_cmd_item_get_first();
552 return false
Great library BTW
Thanks
Neat app!
I think a cool addition would be a command that behaved like the analogwrite function in Arduino.
Hello,
I have some trouble finding appropriate filesystem with my NOR flash with embedded stm32 device. The external flash has a large erase sectors flash (128K).
I thought about various options (I have large RAM), but not yet sure what is best.
I found this great filesystem, but I think we also have configuration file.
Can it be used with configuration file ? If not, do you have any suggestion for this problem ?
Thank you very much!
Ran
The VT100 escape sequences all start with "\e", which is a non-standard escape sequence. See https://en.wikipedia.org/wiki/Escape_sequences_in_C#Non-standard_escape_sequences.
I would suggest replacing the "\e" with "\x1B", which is standard and should be supported by all compilers.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.