Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : PicoMite V5.07.06 preview - flash file system
Page 5 of 5 | |||||
Author | Message | ||||
Tinine Guru Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
De facto standards tend to be used quite a bit. Craig |
||||
Tinine Guru Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
Very slick Yeah, I had to extract first (W10) Many thanks Jim |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3805 |
In the kinds of things you do, yes. Overall in computers, MODBUS just isn't. And a software CRC is hardly a problem with today's fast CPUs. Ideal for a CSUB, most likely, if even needed to be so fast. (On such as a Pico, a lookup table could be used to help it be faster if coded in MMBasic - again, if needed.) Of course if Peter feels flash space can be used up for it, no problem. John Edited 2022-12-20 22:24 by JohnS |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4253 |
Hi Peter, About the CRC. I envision following format CRC16% = MATH CRC A,B Where A is an array of data, simplest is to support only a string (array of uint8). When choosing integers, you need al kinds of conversions to make sure you are not CRC'sin leading zero's when 16 bit integers are stored in 64bit variables. Where B is an array with CRC configuration parameters. B can be omitted using MODBUS (CRC16-IBM). The array contains the following (directly mapped onto the arduino library). DIM conf%(4)=(Polynomal, XORstart, XORend, RevIn, RevOut) For MODBUS: Polynomal = &h8005 XORstart = 0 (boolean) XORend = 0 (boolean) RevIn = 0 (boolean) RevOut = 0 (boolean) Info: Wiki library Online check IS this what you wanted me to do ? Or did I misunderstand the question ? Volhout PicomiteVGA PETSCII ROBOTS |
||||
Tinine Guru Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
@Volhout: JohnS has a point...have you tried the captain's look-up table method on FoTS? Craig |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4253 |
Hi All, Yes, I have looked at Captains lookup table method. Let me explain: a turn-around time is the time between end of the command message and the start of the response message. In this timeframe, you have to decode the command message, after checking CRC (calculating CRC). Generate the response, the response CRC, and start sending the response. So you need 2 CRC generations, and some basic decoding of the message. In 1 ms. Unless you are multitasking, then you can do the CRC calculations during other tasks. Some numbers on picomite (test string = "hello"). CRC16-CCITT : 7ms CRC16-IBM (modbus) : 12ms CRC16-IBM table method: 1.7ms The table method is much faster, but just not fast enough. I can run the pico at 378MHz, and then you get to 0.6ms. Not fast enough (only the 2 CRC's are 1.2ms). To get it faster... (or find an alternative solution) I would need a CSUB or MATH CRC. Maybe it is time to learn CSUB making... Maybe I am being lazy, or hesitant to take the CSUB training, and looked to Peter to do the work for me. I appologize for the question raised. Sorry Peter. Regards, Volhout PicomiteVGA PETSCII ROBOTS |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1245 |
I think CSubs are much easier than many think. Especially when you can easily convert it from Arduino code. Maybe Geoff should add a short CSub guide as a PDF to the firmware? ... and some examples too? (as for the Micromite) Regards Michael BTW. @Harm I like your excellent PIO thread but I don't think it's a good idea to jump in there just to say thank you. Edited 2022-12-21 01:15 by twofingers causality ≠ correlation ≠ coincidence |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4253 |
Can't comment accurately on the overhead of large number of files on space used. but I know each file uses c 1K for a header so every 4 files or so will eat another 4K block OK, you are using 4k blocks. That completely explains it... 6006bytes eat up 2 of the 4k blocks = 2x4096 = 8192bytes 85 files = 85x8192 = 696320 bytes = 700k. Total flash filesystem was 700k bytes ... so it is full.!!! Volhout PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9131 |
See new thread for CRC support Please use new thread for any further posts on 5.07.06 Edited 2022-12-21 01:31 by matherp |
||||
CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 2079 |
correction: Turbo46's method |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1611 |
Sorry for resurrecting and old thread but this is where the MATH CRC thing started. The manual says: Calculates the CRC to n bits (8, 12, 16, 32) of “data”. “data” can be an integer or floating point array or a string variable. “Length” is optional and if not specified the size of the array or string length is used. The defaults for startmask, endmask reverseIn, and reversOut are all zero. reverseIn, and reversOut are both Booleans. The defaults for polynomes are CRC8=&H07, CRC12=&H80D, CRC16=&H1021, crc32=&H04C11DB7 e.g. for crc16_CCITT use MATH(CRC16 array(), n,, &HFFFF) It doesn't attempt to explain the use and meaning of all of the arguments like startmask, endmask, reverseIn and reversOut. I have looked at the references Volhout provided but I'm really none the wiser. Can someone please explain in simple terms what they are used for and how they would affect the calculation and presentation of the CRC value? Setting the reverseOut argument to either 0 or 1 does not change the result of a MODBUS CRC calculation? Bill Keep safe. Live long and prosper. |
||||
panky Guru Joined: 02/10/2012 Location: AustraliaPosts: 1101 |
Bill, This link crc explained gives a pretty useful explanation of crc and may help decoding the MMBasic implimentation. Regards, Doug. PS. I intend putting a link into the MMB4W manual about this. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1611 |
Thanks Doug, I've been there but it doesn't explain the use of those parameters - not to me anyway. I put the CRC entries on the Fruit of the Shed (TassyJim wrote the first one) so I've been playing with CRCs for a while. Those unexplained parameters are there to make the routines more flexible (I believe) but I would just like their use and affects explained. Bill Keep safe. Live long and prosper. |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6101 |
The wikipedia entry is another reference https://en.wikipedia.org/wiki/Cyclic_redundancy_check IT has a long list of known CRC values I think 'reverse' refers to bits being shuffled in LSB first. ONEWIRE does that so I used 1 for reverseIn and reverseOut and I started getting the correct results. Jim VK7JH MMedit MMBasic Help |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1611 |
Thanks Jim, I've been there too. I expected that reverseIn and reverseOut reversed the bit order of calculating the CRC and the bit order of presenting the CRC value respectively but as I said earlier: setting the reverseOut argument to either 0 or 1 does not change the result of a MODBUS CRC calculation. So I am unsure about that and that makes me unsure about the effect of using reversIn too. Bill Keep safe. Live long and prosper. |
||||
Page 5 of 5 |
Print this page |