2020年10月11日 星期日

MikroTik RouterOS 設定 NAT

WebFig進入點: IP>FireWall>NAT頁面

Chain: dstnt
Protocol: 6(tcp)
Dst. Port: AAAA-BBBB
Dst.Address type: local
Action: dst-nat
To Address: 192.168.88.NNN
To Port:AAAA-BBBB

2020年10月1日 星期四

[ESP32] Using the MFRC522 RFID reader and SD card reader

Today some guy in the Facebook proposed an interesting problem about how to use the RFID and the SD in ESP32s .  Both peripheral devices used the SPI connections. The point is they need it's own CS (chip select) pin to enable the SPI (MOSI/MISO/CLK) bus. Only one of them can be enabled in the same time because the enabled device will occupy the SPI bus.

Uusing the original SD ReadWrite code of the arduino example, we could find it's failed even if the CSs are defined well. To see what happened, I checked the compiler messages, as the following:

Use library SPI、verison 1.0,in folder:C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\SPI
Use library SD、version 1.0.5,in follder:C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\SD
Use library FS、version 1.0,in folder:C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\FS

From the view point of the software architecture, the SD layer is stacked above the FS which is stacked on the SPI hearware driver. The above messages showed that ESP32 SD library was applied, which caused the original SD ReadWrite code to be failed. 

To solve the problem, some library definition are to be modified as the follows.