III - Advanced Project » History » Version 36
« Previous -
Version 36/59
(diff) -
Next » -
Current version
COLIN, Tony, 12/14/2015 10:59 AM
III - Advanced Project.¶
- Table of contents
- III - Advanced Project.
1. Adapting project to elementary task.¶
See Tutorial page for project bases.
In this part, you will have to modify particular files of the previous folder Test/.
1.1 Integration of C Source files into task(s).¶
- task_name.c stating void task_name (void) { ... }.
Here you can either call the C main function in the task_name function or adapting your main file into one or several tasks (for simultaneity during process).
- task_name.h stating extern void task_name (void); and other intern functions.
1.2 Definition of your task(s) to be called.¶
- tasks.h defining OSTCBP of all predifined tasks i.e. the way of specifying a pointer to a particular Salvo Task Control Block. More information is available on Salvo User Manual.
- task_cmd.c which is a tool provided by Test/ that allows to resume/stop your task(s).
- main.c i.e. the basic implementation to call your task(s). All statements are essential for Salvo and CSK to work.
2. Integration of a Reed-Solomon encoder/decoder.¶
A highly convenient implementation of a Reed-Solomon code is available on RS Code Website and will be integrated in the following.
2.1 Presentation of Reed-Solomon.¶
This is an implementation of a Reed-Solomon code with 8 bit bytes, and a configurable number of parity bytes. The maximum sequence length (codeword) that can be generated is 255 bytes, including parity bytes. It provides the following C/H - files :
(1) rs.c, (2) berlekamp.c, (3) crcgen.c, (4) ecc.h and (5) example.c
The rs.c file contains an algorithm to generate the encoder polynomial for any number of bytes of parity, configurable as the NPAR constant in the file ecc.h. For this RS code, G(x) = (x-a^1)(x-a^2)(x-a^3)(x-a^4)...(x-a^NPAR) where 'a' is a primitive element of the Galois Field GF.
rs.c contains also a decoder that generates four syndrome bytes, which will be all zero if the message has no errors.
The more general error-location algorithm is the Berlekamp-Massey algorithm (implemented in berlekamp.c), which will locate up to four errors, by iteratively solving for the error-locator polynomial.
More information is available on rs.doc and config.doc.
2.2 Task Example.¶
The example of Reed-Solomon code example.c can be used to implement our encoder/decoder in a simple task.
See 1.1 and 1.2 for the definition and integration of task_example.c
3. Displaying results.¶
3.1 In simulation.¶
Message of 87 characters
Code of adding errors
Checking Output UART Window
Displayed result
3.2 On board.¶
In this part, we are focusing the last byte of the message.
- | Char | Code ASCII | Hexadecimal | Binary |
---|---|---|---|---|
Codeword | 2 | 50 | 0x32 | 0b00110010 |
Erroneous Codeword | 3 | 51 | 0x33 | 0b00110011 |
A first function void display_6bits(unsigned char* string, int index) has been written in order to light up the six LEDs according to the most right six bits of the binary representation of the character indicated by the index in string. A second function void reset_leds(void) switchs off the LEDs.
__________ a. Codeword : 0bXX110010 ________________ b. Erroneous codeword : 0bXX110011 ____________ c. Corrected codeword : 0bXX110010 ______
4. Measurement of encoding/decoding time.¶
POSIX requires that CLOCKS_PER_SEC equals 1000000 independent of the actual resolution.
1000 ticks per milliseconds
Time measurement of data encoding
Printing clock data
Chart of Reed Solomon time measurement