Gainspan module evaluation with WIZwiki-W7500 using SerialPassthrough.

Dependencies:   mbed

Fork of SerialPassthrough_GainspanModule_W7500 by Steve Kim

This is a serial-passthrough example using WIZwiki-W7500 and gainspan-WiFi-module.

With this example, I can issue at-command-sets to the WiFi module with WIZwiki-W7500's serial. UART data flow is shown as below.

[PC Serial Terminal] <=> [WIZwiki-W7500's UIART1/DAP] <=> [WIZwiki-W7500's UIART0] <=> [Gainspan WiFi module]

Connected pins between WIZwiki-W7500 and WiFi-module are only 4 pins. (3.3V, GND, UART-Tx, UART-Rx) And, here is a picture. /media/uploads/SteveKim/gainspan-w7500.jpg

And here is a captures of test logs. Red box is what I issued.

/media/uploads/SteveKim/gainspan-w7500-2.jpg

[PS] ASYNC_DEBUG is for internal-debugging like ISR. You can ignore it.

Committer:
SteveKim
Date:
Fri Aug 21 07:03:18 2015 +0000
Revision:
2:c6fa1badaeff
Parent:
0:98000a7ccec5
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
SteveKim 0:98000a7ccec5 1 /* Copyright (C) 2012 mbed.org, MIT License
SteveKim 0:98000a7ccec5 2 *
SteveKim 0:98000a7ccec5 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
SteveKim 0:98000a7ccec5 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
SteveKim 0:98000a7ccec5 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
SteveKim 0:98000a7ccec5 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
SteveKim 0:98000a7ccec5 7 * furnished to do so, subject to the following conditions:
SteveKim 0:98000a7ccec5 8 *
SteveKim 0:98000a7ccec5 9 * The above copyright notice and this permission notice shall be included in all copies or
SteveKim 0:98000a7ccec5 10 * substantial portions of the Software.
SteveKim 0:98000a7ccec5 11 *
SteveKim 0:98000a7ccec5 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
SteveKim 0:98000a7ccec5 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
SteveKim 0:98000a7ccec5 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
SteveKim 0:98000a7ccec5 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
SteveKim 0:98000a7ccec5 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SteveKim 0:98000a7ccec5 17 */
SteveKim 0:98000a7ccec5 18
SteveKim 0:98000a7ccec5 19 #ifndef CIRCBUFFER_H_
SteveKim 0:98000a7ccec5 20 #define CIRCBUFFER_H_
SteveKim 0:98000a7ccec5 21
SteveKim 0:98000a7ccec5 22 template <class T>
SteveKim 0:98000a7ccec5 23 class CircBuffer {
SteveKim 0:98000a7ccec5 24 public:
SteveKim 0:98000a7ccec5 25 CircBuffer(int length) {
SteveKim 0:98000a7ccec5 26 write = 0;
SteveKim 0:98000a7ccec5 27 read = 0;
SteveKim 0:98000a7ccec5 28 size = length + 1;
SteveKim 0:98000a7ccec5 29 buf = (T *)malloc(size * sizeof(T));
SteveKim 0:98000a7ccec5 30 };
SteveKim 0:98000a7ccec5 31
SteveKim 0:98000a7ccec5 32 bool isFull() {
SteveKim 0:98000a7ccec5 33 return (((write + 1) % size) == read);
SteveKim 0:98000a7ccec5 34 };
SteveKim 0:98000a7ccec5 35
SteveKim 0:98000a7ccec5 36 bool isEmpty() {
SteveKim 0:98000a7ccec5 37 return (read == write);
SteveKim 0:98000a7ccec5 38 };
SteveKim 0:98000a7ccec5 39
SteveKim 0:98000a7ccec5 40 void queue(T k) {
SteveKim 0:98000a7ccec5 41 if (isFull()) {
SteveKim 0:98000a7ccec5 42 read++;
SteveKim 0:98000a7ccec5 43 read %= size;
SteveKim 0:98000a7ccec5 44 }
SteveKim 0:98000a7ccec5 45 buf[write++] = k;
SteveKim 0:98000a7ccec5 46 write %= size;
SteveKim 0:98000a7ccec5 47 }
SteveKim 0:98000a7ccec5 48
SteveKim 0:98000a7ccec5 49 void flush() {
SteveKim 0:98000a7ccec5 50 read = 0;
SteveKim 0:98000a7ccec5 51 write = 0;
SteveKim 0:98000a7ccec5 52 }
SteveKim 0:98000a7ccec5 53
SteveKim 0:98000a7ccec5 54
SteveKim 0:98000a7ccec5 55 uint32_t available() {
SteveKim 0:98000a7ccec5 56 return (write >= read) ? write - read : size - read + write;
SteveKim 0:98000a7ccec5 57 };
SteveKim 0:98000a7ccec5 58
SteveKim 0:98000a7ccec5 59 bool dequeue(T * c) {
SteveKim 0:98000a7ccec5 60 bool empty = isEmpty();
SteveKim 0:98000a7ccec5 61 if (!empty) {
SteveKim 0:98000a7ccec5 62 *c = buf[read++];
SteveKim 0:98000a7ccec5 63 read %= size;
SteveKim 0:98000a7ccec5 64 }
SteveKim 0:98000a7ccec5 65 return(!empty);
SteveKim 0:98000a7ccec5 66 };
SteveKim 0:98000a7ccec5 67
SteveKim 0:98000a7ccec5 68 private:
SteveKim 0:98000a7ccec5 69 volatile uint32_t write;
SteveKim 0:98000a7ccec5 70 volatile uint32_t read;
SteveKim 0:98000a7ccec5 71 uint32_t size;
SteveKim 0:98000a7ccec5 72 T * buf;
SteveKim 0:98000a7ccec5 73 };
SteveKim 0:98000a7ccec5 74
SteveKim 0:98000a7ccec5 75 #endif