Implement PTP (Precision time protocol) on LS1043 or i.MX RT nxp microcontroller - freertos

Do someone know how to write a simple code that enable the PTP and use it to synchronize the clock between two microcontrollers ? any idea ?
I have no idea to code for nxp microcontroller

Related

Micro SD Card as Arduino "main memory"

I would like to know if it is possible to store font code in a Micro SD card and then, afterwards, access this code to run the routines.
I'm doing some stuff with Arduino nano and due to the amount of sensors and components, I'm having problems with memory. It is causing an instability that might affect things to work properly.
Any suggestions?
The best suggestion that I can give you, is switch to an Arduino Mega, or an Arduino Due.
If you are not open to that solution, then things are going to be rough.
What you will need to do, is write a bootloader, which is able to read from the memory card and change the flash contents of your Atmega.
What this essentially means is that you have to write an OS level program for your Arduino Bootloader, and use the memory card like a hard-disk and the rest of your Arduino flash as the program RAM.
I hope this helps, good luck.
Nitro, Gerhard and datafiddler,
My problem was solved by a simple code optimization. I'm new to this Arduino world and so I was using a lot of unnecessary stuff.
I appreciated the help provided. Thanks!

ESP8266 Node MCU powered by battery

I am new to ESP8266 and started just building basic devices using it. However I am using USB 5V wall adapter as nodeMCU has USB UART converter to 3.3V.
If I want to make it battery powered what is simple , small ( in volume so that it can fit along with nodemcu and sensors in a small case) and economical approach that keeps my nodemcu still safe?
-One option I can think of is to connect a Li-ion battery of 3.7V to VIN.
-Another one is to use bigger voltage and use a converter to convert it down to around 5V and then use that to connect to VIN.
Please let me know if this works ? else if there is any better option please do suggest. Also if you are referring to any items/products please help give the exact model numbers so that I can search on internet to consider buying them.
Lastly I am not much aware of electric circuits & terminology yet ( learning them), so please help explain me in basic terms possible.
Ps: this question was seen on stackoverflow some times but I couldnt find one single consolidated answer and am confused by it. Appreciate your understanding.
Thanks,
Sridhar.
This really would be better suited for the electronics sister site or a esp8266.com forum but for what it's wort here's my input.
IMHO the most convenient option you have is to buy a devkit with a LiPo connector. I recommend a WeMOS D1 mini plus a fitting battery shield. An alternative is the Adafruit Feather HUZZAH.
It can sometimes be a bit of a challenge to find the right connectors for those boards. Gotcha! different revisions of those boards might use different connectors. Currently the WeMOS battery shield uses a 2 pin JST PH 2.0mm.
No, you cannot power a NodeMCU using a 3.7v li-ion battery directly. A fully charged Li-ion battery outputs a voltage of 4.2v. The NodeMCU board has a (5v and above) vin slot along with two 3.6v slots. If you directly connect the battery to the 3.6v, it may fry the NodeMCU board. So typically, there are 3 ways you can connect the battery without frying your board in this scenario:
You can use a boost converter to convert the 4.2v output to 5v. Then connect it to vin. This will draw more current and battery discharges quickly (eg: MT3608 step up boost converter).
You can use a buck converter to convert the 4.2v to a steady 3.6v (eg: LM2596 step down converter).
Finally, the most efficient way is to connect a 3.3v LDO in middle. The difference between using a buck and LDO is, buck provides a constant and steady 3.6v output, where as LDO's output depends on the input voltage from battery (eg: S111733PI).

How to power nodemcu devkit using battery

I like software and I am comfortable writing lua code for nodemcu devkit. But I am not a hardware guy.
I need to setup the nodemcu so that it is a standalone module, ie powered by a battery. What is the best way to do this so that the whole thing is as small as possible? Which battery should I use(If I need to continuously run the nodemcu for 2 hours with wifi ON)? How to connect the battery with the nodemcu, ie any regulator needed?
Right now I am powering nodemcu via USB. I researched this in google, but couldn't find a satisfactory solution.
I am using this nodemcu devkit
Please point me to the correct forum, if this is the wrong place to ask this question
The easiest would be to NOT use that devkit but use one with a LiPo connector instead e.g. https://www.adafruit.com/product/2821. An alternative would be to use WeMos D1 minis with a LiPo/battery shield.
If you want to stick to your devkit you "just" have to make sure you feed 3.3V to the 3.3V pin. Since batteries deliver no stable voltage over time you need to place some kind of buck/boost converter (step-down/step-up) between the battery and the module.
You could of course also target the VIN pin which expects 5V but that would be less efficient if you used a LiPo battery. First, the external converter would boost from the LiPo's ~3.7V to 5V. Then the devkits internal converter would have to bring this down to 3.3V again.
Furthermore, if you feed the ESP8266 from batteries you want to pay attention to any power that'd be lost along the way. With the L7805 voltage regulator for example there is a constant 'quiescent' current draw of 6mA. That may be ok if your source is a power adapter but less ideal when it's a battery. Buck/boost converters are more efficient.
If you just need it to stand alone, would you consider using a phone charger? Just simply plug in the USB cable to any phone charger that you can find. That way it will provide stable power for as long as you want.
In case you really want to use a battery. Then you will need a 7805 regulator IC. This will step down your voltage to 5V. Then direct this to Vin Pin on the NodeMCU. I believe you should get 3.3V out of the 3v3 pin.

UART to SD Card

I'm trying to implement a method to write data to an SD card from a dsPIC33F. I currently can transmit the data via UART to Bluetooth and USB, but I can't find anything online in regards to writing to an SD card via UART; it all seems to be SPI.
I would use SPI, but I'm already using I2C and it seems to be difficult to use both SPI and I2C on the same PIC, due to them sharing pins.
So, can anyone suggest any information on writing data to an SD card via UART, or maybe a way to use both SPI and I2C concurrently?
All I want is some form of storage method, so if someone can suggest another method, maybe EEPROM or USB flash drive, then I'm all ears. I will need at least 2GB of storage, the more the better.
Most SD cards natively support SPI communication but not UART so a direct UART connection isn't possible. I would recommend against the USB flash drive as there is a lot of overhead there that complicates things. And EEPROM is likely to use SPI or I2C so you're still left with the problem of having the one set of peripheral pins already in use.
Your best option given the chip you are using is to use the Peripheral Pin Select feature to map some available pins to be the 4 SPI pins you need. Section 11.6 of the datasheet has a good explanation of how to remap pin functions. That is probably the easiest solution.
One other approach you could possibly use is to use the UART to communicate with another PIC that has the SPI pins available but that, too, introduces a lot of extra overhead and complexity.
SD cards can work with SDIO or SPI.
In order to eliminate the SPI / I2C pin sharing problem, I would:
1) check if the sensor can be replaced with an SPI one
2) if not, I would implement an Software SPI using other pins (the MCU is Master, thus this is much easier)

iOS-Arduino communication: any cheap solution?

I'd like to have an iPhone and an Arduino-based device talk to each other. Here are the requirements:
I want to fully rely on iPhone's built-in components without any peripherals (for example, HiJack).
The less configuration before the two can communicate, the better. This means a WiFi-based is not desirable, because we'll need to set up Wi-Fi credentials for the Arduino beforehand.
Bitrate is not important. Only a few bytes are exchanged.
As cheap as possible.
I see that Bluetooth 4.0 LE (for example, Stack Overflow question iPhone - Any examples of communicating with an Arduino board using Bluetooth?) meets my requirements, but are there any cheaper solutions?
One thing that came into my mind is sound - the way Chirp used to share data between two iOS devices, but I don't know if is feasible on Arduino and, if it is, how much it would be. Any other solutions?
I can think of a few options:
Bluetooth, you can get a cheap one from eBay for about $10
Wi-Fi using Electric Imp (cost around $30), which is very easy to setup using the brilliant BlinkUp technique. See the project ElectricImp, control central heating via iPhone for an example.
Chirp is a brilliant idea as well. From a hardware prospective I see it is feasible to do in Arduino; you just need a MIC circuit ($8) and speaker.
However, the real challenge is the software side, i.e., the algorithm that you will use to encode data as sound and vice versa. If such algorithm requires intensive calculation, you might not be able to do it in Arduino, and you can consider using an ARM-based microcontroller.

Resources