Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 //******************************************************** 00003 //** Nucleo-144 Stm32F746 and Stm32F767 bitbanging ****** 00004 //** Port setting and pattern generation ****** 00005 //** Speed - Benchmark ****** 00006 //** Jovan Ivković - 2016. ****** 00007 //** JovanEps (jovan.eps@gmail.com). ****** 00008 //******************************************************** 00009 00010 DigitalOut myled(LED1); 00011 DigitalOut PD7(PF_13); 00012 DigitalOut PD5(PE_11); //introduce D5 pin-out it ping faster :) 00013 DigitalOut PD13(PA_5); //introduce D13 pin-out 00014 Serial pc(USBTX, USBRX); 00015 Timer timer; 00016 00017 void Pinging() 00018 { 00019 int i, vreme = 0, loop_vreme=0, noop=0; 00020 while(1) { 00021 // Pattern and port setting speed benchmark 00022 timer.start(); 00023 // Measure loop and value setting time for 1k runs 00024 loop_vreme = timer.read_us(); 00025 for ( i = 0; i <= 999; i++ ) { 00026 noop = i; 00027 } 00028 // ----- 00029 loop_vreme = timer.read_us() - loop_vreme; 00030 timer.reset(); 00031 // Measure 10 bit sequence pattern 00032 vreme = timer.read_us(); 00033 for ( i = 0; i <= 999; i++ ) { 00034 PD5 = 1; // D5 go low 1 go LOW in next 69..75ns as Tf propagates signal on osciloscope 00035 PD5 = 1; // D5 go low 2 00036 PD5 = 1; // D5 go low 3 00037 PD5 = 0; // D5 go inv-high on SN74vhc14 - >1.6..2.4V < 1.75ns 00038 PD5 = 1; // D5 go low 5 00039 PD5 = 1; // D5 go low 6 00040 PD5 = 1; // D5 go low 7 00041 PD5 = 1; // D5 go low 8 00042 PD5 = 1; // D5 go low 9 00043 PD5 = 1; // D5 go low 10 00044 } 00045 vreme = timer.read_us() - vreme; 00046 wait_us(0.2); 00047 pc.printf("Port set time (single)... %6.2f ns \t tested on for: %d runs \n", ( float ) ( vreme - loop_vreme ) / 10, i * 10 ); //1000x10=10k sets of PD5 div 10 for ns 00048 pc.printf("\n %d \n\n", noop+1); 00049 timer.stop(); 00050 00051 /* // Alternative 00052 while(1) { 00053 PD5 = 0; // D5 go low 1 00054 PD5 = 0; // D5 go low 2 00055 PD5 = 0; // D5 go low 3 00056 PD5 = 1; // D5 go inv-low on 74vhc14 - <0.6v..0.9V < 1.6ns 00057 PD5 = 0; // D5 go low 5 00058 PD5 = 0; // D5 go low 6 00059 PD5 = 0; // D5 go low 7 00060 PD5 = 0; // D5 go low 8 00061 PD5 = 0; // D5 go low 9 00062 PD5 = 0; // D5 go low 10 00063 wait_us(0.3); 00064 */ 00065 //pc.printf("\n"); 00066 } 00067 } 00068 00069 int main() 00070 { 00071 myled = 1; // LED is ON - working 00072 pc.baud(115200); 00073 //pc.baud(921600); // Max garanted UART/seriall speed 00074 pc.printf("Starting...\n"); 00075 wait(0.2); // 200 ms 00076 00077 //NVIC_DisableIRQ(XXX); // Disable NVIC interrupt; 00078 Pinging(); //Call of Pinging methode 00079 00080 /* 00081 while(1) { 00082 // PD7 = 1; // D7 go high in Tr ~69..75ns 00083 //PD13 = 1; // D13 go high has delay of 00084 // myled = 1; 00085 00086 PD5 = 0; // D5 go high 00087 //wait(0); // 1ns - exclude, we need as fast as we can get 00088 // PD7 = 0; // D7 go low in next 69..74ns 00089 //PD13 = 0; // D13 go high 00090 // PD7 = 1; 00091 //PD13 = 1; // D13 go high 00092 PD5 = 0; 00093 // PD13 = 0; // D13 go high 00094 //myled = 0; 00095 PD5 = 0; // D5 go low 00096 PD5 = 1; // D5 go inv-high on 74vhc14 - 1v 00097 PD5 = 0; // D5 go low 00098 PD5 = 1; // D5 go inv-high on 74vhc14 -2v 00099 PD5 = 0; // D5 go low 2v 00100 PD5 = 1; // D5 go inv-high on 74vhc14 - 2v 00101 PD5 = 0; // D5 go low 2v 00102 PD5 = 1; // D5 go inv-high on 74vhc14 - 3v 00103 PD5 = 0; // D5 go low 3v 00104 //v4 111010101010101 4-low lead and 6-inv-peek 00105 PD5 = 1; // D5 go inv-high on 74vhc14 - 4v 00106 PD5 = 0; // D5 go low 4v 00107 PD5 = 1; // D5 go inv-high on 74vhc14 - 4v 00108 PD5 = 0; // D5 go low 4v 00109 //wait(0);// 1nsec - exclude, we need as fast as we can get 00110 00111 } 00112 */ 00113 }
Generated on Tue Jul 26 2022 00:42:53 by
1.7.2