priombiswas22
Newbie
I have the following requirement to design behaviors of two software components, one for writing data to SD card and another for controlling the LED based on the mode of SD card:
Datalogging sensor can write data to a FAT16-formatted SD card that is inserted into the card reader slot. When the board is booted and a valid card is detected, a new file is created and data from all messages on the can bus is written into this file. There is no mechanism to specifically close the log file. Just remove the card or power down the board. There is a bootloader in the board which checks whether the SD card is valid or invalid and sends signal to datalogging sensor accordingly.
I have come up with the following state chart:
To control the LEDs, there are two LEDs. I have following requirement: LED "LOGGER ON" When this LED is on, the SD card is present, has been detected and the file could be opened for writing. LED "LOGGER WRI" This LED blinks once each time a 512 Byte sector is dumped to the SD card. The Write LED is turned on after the SD card has been initialized. If it stays on and the "LOGGER ON" LED stays off, the file system could not be initialized. Most likely this means that the SD card has the wrong format, but for some reasons even if the format is correct, filesystem initialization always fails on some cards. I have come up with following state chart:
Are my models correct?
I have thought about my architecture design like below:
I have specified a bit further on my own: Bootloader will send the signals (SDCardValid and SDCardInvalid) whether a sd card is valid or invalid. If logging sensor receives valid signal, and there are error messages present, sensor will write the data to sd card and notifies the systemcontroller that the sd card is in write mode via SDCardWRI signal. If sd card is invalid, logging sensor notifies the systemcontroller that there is problem with the sd card with SDCardProblem signal.
Datalogging sensor can write data to a FAT16-formatted SD card that is inserted into the card reader slot. When the board is booted and a valid card is detected, a new file is created and data from all messages on the can bus is written into this file. There is no mechanism to specifically close the log file. Just remove the card or power down the board. There is a bootloader in the board which checks whether the SD card is valid or invalid and sends signal to datalogging sensor accordingly.
I have come up with the following state chart:
To control the LEDs, there are two LEDs. I have following requirement: LED "LOGGER ON" When this LED is on, the SD card is present, has been detected and the file could be opened for writing. LED "LOGGER WRI" This LED blinks once each time a 512 Byte sector is dumped to the SD card. The Write LED is turned on after the SD card has been initialized. If it stays on and the "LOGGER ON" LED stays off, the file system could not be initialized. Most likely this means that the SD card has the wrong format, but for some reasons even if the format is correct, filesystem initialization always fails on some cards. I have come up with following state chart:
Are my models correct?
I have thought about my architecture design like below:
I have specified a bit further on my own: Bootloader will send the signals (SDCardValid and SDCardInvalid) whether a sd card is valid or invalid. If logging sensor receives valid signal, and there are error messages present, sensor will write the data to sd card and notifies the systemcontroller that the sd card is in write mode via SDCardWRI signal. If sd card is invalid, logging sensor notifies the systemcontroller that there is problem with the sd card with SDCardProblem signal.