Sinapse-Energia / talking-fiber

Firmware for optic fiber activity detection. Based on M3 MCU
0 stars 1 forks source link

Refactor provided code in order to fit the talking-fiber requirements #1

Closed ralcaide closed 6 years ago

ralcaide commented 6 years ago

The provided code have several features not needed to this product but maybe are useful to start and understand the architecture. It is necessary to run it in the talking fiber board performing the necessary modifications (GPIO Init) and then start delete all the unnecessary code.

Steps:

  1. This is a new board not integrated until now. Create a new board type named talking-fiber
  2. Modify GPIO Init in order to fit the new board. For example: PB15 should be set to 1 in order to power up the Quectel. PB14 should be set to 1 (Mosfet). PC5 should be set to 1 (photo-diode)
  3. Delete unnecessary transceivers. This project uses only M95
  4. Delete unnecessary frames from the API engine
  5. Delete unnecessary southbound code
vAnArhist commented 6 years ago

After changing context and connection code to given one GPRS connection stuck at several random commands. Almost always at "AT+QIACT".

ralcaide commented 6 years ago

OK, this is a problem. Please try to find the reason asap, if it is not found after 1-2 hours, go further to the previous version and we will come back to that at the end of the project. At this moment we can not be blocked here

ralcaide commented 6 years ago

Tested KO: Working with AP basic code instead M2M

ghost commented 6 years ago

Proposal: While we are not figured and fixed issue with M2M we will push code in 2 branches. AP_based and M2M_based. It will allow us to have always up to date southbound and metadata/context changes in both versions. When we will fix M2M issue, we will merge M2M_based into develop.

ralcaide commented 6 years ago

Ok, I'm right with your approach. We will continue testing with AP_based branch

ghost commented 6 years ago

Hi. Now M2M version of code is working. Seems we had some random problem and now it is disappeared. But we have several issues: 1) Time management: after getting time from NTP we have date/time like 9-3-2036 06:28:46. 2) When setting 60 seconds in scheduler real actions appear once 2 minutes instead of once 1 minute.

We will investigate more in future.

ghost commented 6 years ago

We also added defines to disable SD driver in AP version. TODO add flash driver into AP code. Should we use internal flash or there is some external flash onboard?

ralcaide commented 6 years ago

Thanks for the commits and questions. Regarding your comments:

  1. Time management: Why? it is a problem of the RTC?.
  2. I don't understand very well the problem. Is the scheduler working like the T = 2* TReal?
  3. We will use internal flash, a little part of it because in this product is not required to save a lot of parameters in the NVM
ralcaide commented 6 years ago

Also, If I understand well, now the M2M_Based and the AP_Based branches are working, right? What is the difference between them?

ghost commented 6 years ago
  1. Getting time from time server in M2M communication code is not working very well in our device.
  2. When you set scheduler period to 1 minute it publish each 2 minutes. (2 times slower). This is some problem with timer that is increasing 10 sec. We will solve it.

Only differences between branches now is engine and communication versions. Also I would like to ask if there is some parameters map for current project. In AP and in M2M version we left a lot of parameters in context, maybe some of them is not needed.

ralcaide commented 6 years ago

Ok, so by the moment AP_Based is working better.

Parameters map: Is still not available but I will try to provide it asap. We will use much more less parameters. Basically only the related with connection (APN, Broker, Topics) and the specific of TF

ralcaide commented 6 years ago

Testing AP_based, periodic enabled = 15 min and alerts enabled = 15 min, quectel always ON. Result: Publish only one time the periodic and the alert message.

Why? Try to reproduce and fix, please

ralcaide commented 6 years ago

Tested OK AP_Based