Is anyone using the Linux ARM version?
Me not.
Enough T4 for today.. it's 18:00 here and a cold beer waits.
HAPPY NEW YEAR TO EVERYONE!
Is anyone using the Linux ARM version?
class TestSerial : public Stream {
public:
TestSerial() {state_ = 0;};
virtual int available(void);
virtual int peek(void);
virtual void flush(void);
virtual size_t write(uint8_t c);
virtual int read(void);
using Print::write;
size_t nonVirtualfunc(uint8_t c);
uint8_t state_;
};
int TestSerial::available(void) {return 0;}
int TestSerial::peek(void){return 0;}
void TestSerial::flush(void) {return;}
size_t TestSerial::write(uint8_t c) {
digitalWrite(3, HIGH);
state_ = state_? 0 : 1;
digitalWrite(13, state_);
digitalWrite(3, LOW);
return 0;
}
size_t TestSerial::nonVirtualfunc(uint8_t c) {
digitalWrite(3, HIGH);
state_ = state_? 0 : 1;
digitalWrite(13, state_);
delay(100);
digitalWrite(3, LOW);
return 0;
}
int TestSerial::read(void){return 0;}
TestSerial ts;
void setup() {
while ( !Serial && millis() < 600 ) {
if ( 0 == ARM_DWT_CYCCNT && 0 == ARM_DWT_CYCCNT ) {
digitalWrite(LED_BUILTIN, HIGH);
// SOME_SERIAL.println( " ARM_DEMCR_TRCENA done!" );
ARM_DEMCR |= ARM_DEMCR_TRCENA;
// ARM_DWT_CTRL |= ARM_DWT_CTRL_CYCCNTENA; // turn on cycle counter << THIS LINE NOT NEEDED
}
}
Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
Serial.println("Test begun");
uint16_t cb = sizeof(TestSerial);
Serial.printf("Test Serial: %x Size:%d ", (uint32_t)&ts, cb);
uint8_t *b = (uint8_t*)&ts;
while (cb--)Serial.printf("%x ", *b++);
Serial.println();
// Now lets try Serial
cb = sizeof(Serial);
Serial.printf("Serial: %x Size:%d ", (uint32_t)&Serial, cb);
b = (uint8_t*)&Serial;
while (cb--)Serial.printf("%x ", *b++);
Serial.println();
// Now lets try Serial1
cb = sizeof(Serial);
Serial.printf("Serial1: %x Size:%d ", (uint32_t)&Serial1, cb);
b = (uint8_t*)&Serial1;
while (cb--)Serial.printf("%x ", *b++);
Serial.println();
// put your setup code here, to run once:
pinMode(13, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
for (uint8_t i=0; i< 5; i++) {
digitalWrite(13, HIGH);
delay(250);
digitalWrite(13, LOW);
delay(250);
}
}
uint8_t buf[]={0,1};
void loop() {
digitalWrite(2, HIGH);
//ts.write((uint8_t)0x00); // see if we call through the virtual function
ts.write(buf, 1);
//ts.nonVirtualfunc(0);
digitalWrite(2, LOW);
delay(500);
}
/Users/kurt/Documents/Arduino/TestVirtualCall/TestVirtualCall.ino Dec 31 2018 09:23:57
Test begun
Test Serial: 20002000 Size:16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Serial: 20000a64 Size:16 14 5 0 20 0 0 0 0 e8 3 0 0 0 0 0 0
Serial1: 200009a0 Size:16 b8 0 0 20 0 0 0 0 e8 3 0 0 0 0 0 0
Print::write 20002000 2000099c 1
0 0 0 0 0 0
Scanning...
Device found at address 0x77 (BMP085,BMA180,BMP280,MS5611,BME280)
done
read8(byte reg) {
uint8_t value;
if (_cs == -1) {
_wire -> beginTransmission((uint8_t)_i2caddr);
_wire -> write((uint8_t)reg);
_wire -> endTransmission();
_wire -> requestFrom((uint8_t)_i2caddr, (byte)1);
value = _wire -> read();
} else {
if (_sck == -1)
SPI.beginTransaction(SPISettings(500000, MSBFIRST, SPI_MODE0));
digitalWrite(_cs, LOW);
spixfer(reg | 0x80); // read, bit 7 high
value = spixfer(0);
digitalWrite(_cs, HIGH);
if (_sck == -1)
SPI.endTransaction(); // release the SPI bus
}
return value;
2009172 Micros=2008310
status = 000A0080
status = 00000000
2012399 Micros=2008310
status = 00070080 << closed here ?
status = 00070080
....
Issues with digitalRead are unresolved. I couldn't reproduce problems with it changing a pin while in output mode, but it does appear to be unable to read the pin if the hardware is configured for output.
19:54:13.821 (loader): Bootloader update: 63% of estimated 8 seconds, wait=50
19:54:13.857 (ports 5): WM_DEVICECHANGE DBT_DEVICEARRIVAL
19:54:13.863 (ports 5): found_usb_device, id=\\?\usb#vid_16c0&pid_0478#000186bd#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
19:54:13.863 (ports 5): found_usb_device, loc=usb:0/1D0000/0/1/6/3 Port_#0003.Hub_#0006
19:54:13.863 (ports 5): found_usb_device, hwid=USB\VID_16C0&PID_0478&REV_0002
19:54:13.863 (ports 5): found_usb_device, devinst=00000011
19:54:13.863 (ports 5): add: loc=usb:0/1D0000/0/1/6/3, class=HID, vid=16C0, pid=0478, ver=0002, serial=000186bd, dev=\\?\usb#vid_16c0&pid_0478#000186bd#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
19:54:13.863 (ports 5): hiddev_from_devinst_list: iface=0
19:54:13.863 (ports 5): found_usb_device complete
19:54:13.863 (ports 5): hid, found devinst=00000012
19:54:13.863 (ports 5): hid, path=\\?\hid#vid_16c0&pid_0478#8&365c6bdd&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
19:54:13.864 (ports 5): hid, opened handle
19:54:13.864 (ports 5): devinst=00000012, location=usb:0/1D0000/0/1/6/3
19:54:13.864 (ports 5): vid=16C0, pid=0478, ver=0002, usepage=FF9C, use=0023
19:54:13.864 (ports 5): devpath=\\?\hid#vid_16c0&pid_0478#8&365c6bdd&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
19:54:13.864 (ports 5): usb_add: usb:0/1D0000/0/1/6/3 hid#vid_16c0&pid_0478 (Teensy 4-Beta) Bootloader
19:54:13.962 (loader): Bootloader update: 64% of estimated 8 seconds, wait=51
19:54:13.962 (loader): Bootloader update finished, 5.1 seconds
19:54:13.962 (loader): Board is: Teensy 4-Beta1 (IMXRT1052), version 0.02
Me not.
Enough T4 for today.. it's 18:00 here and a cold beer waits.
HAPPY NEW YEAR TO EVERYONE!
Paul here is :View attachment Prog_IDE_Hanglog.txt
if ( Serial ) Serial.println( micros() - oMicros );
else Serial4.print( " Serial Offline!" );
Adafruit_BME280::Adafruit_BME280()
: _cs(-1), _mosi(-1), _miso(-1), _sck(-1)
{ }
Adafruit_BME280 bme; // I2C
void setup() {
while (!Serial);
Wire.begin();
delay(1000);
Wire.beginTransmission(0x77);
Wire.write(0xD0);
Wire.endTransmission();
Wire.requestFrom(0x77, (byte)1);
Serial.println(Wire.read(), HEX);
}
Updated the temperature monitoring sketch to read out CCM_ANALOG_MISC1 register bits for the temp IRQ flags. High trips when you get the temp over the high alarm temp but low temp bit seems to be always set - not sure how to get that cleared. The high bit clears automatically when it goes below the high alarm threadhold. Still trying to figure out how to set up nvic enable and association a function call with that. Guess that's next.
Updated the temperature monitoring sketch to read out CCM_ANALOG_MISC1 register bits for the temp IRQ flags. High trips when you get the temp over the high alarm temp but low temp bit seems to be always set - not sure how to get that cleared. The high bit clears automatically when it goes below the high alarm threadhold. Still trying to figure out how to set up nvic enable and association a function call with that. Guess that's next.
Probably another case, like I was running into that the constructor and the like may not be called...Adafruit_BME280::Adafruit_BME280()
: _cs(-1), _mosi(-1), _miso(-1), _sck(-1)
{ }
CCM_ANALOG_PLL_ARM 0x80002064
CCM_ANALOG_PLL_USB1 0x80003040
CCM_ANALOG_PLL_USB2 0x12000
CCM_ANALOG_PLL_SYS 0x80002001
CCM_ANALOG_PFD_480 0xF1A2318
CCM_ANALOG_PFD_528 0x18131818
CCM_CBCDR 0x180A8300
CCM_CBCMR 0x35AE8304
CCM_CCGR1 0xFCFFC000
CCM_CCGR2 0xC3FF033
CCM_CCGR3 0xF00FF300
CCM_CCGR4 0xFFFFFF
CCM_CCGR5 0xF0033C33
CCM_CCGR6 0xFCFF3FC3
CCM_CSCMR1 0x66930040
CCM_CSCDR1 0x6490B40
SCB_CPACR 0xF00000
SYST_CSR 0x10003
SYST_RVR 0x63
mjs513's clocks
System Clock: 600000000
IPG Clock: 150000000
RTC Clock: 32768
USB1pll Clock: 480000000
mjs513 tempmon
TEMPMON driver example.
The chip initial temperature is 48.09
temperature is 49.6
temperature is 49.6
temperature is 48.8
coremark@600mhz (timing with micros())
Total time (secs): 10.875010
Iterations/Sec : 2298.848461 -O2
Iterations : 25000
-O3 2420.504578
-O1 1720.399523
coremarkish Dhrystone 2.1
iterations/sec DMIPS
T4@600mhz 2421 2175 gcc -O3
M7@600mhz 2438 2033 ARM CC -O3
@528mhz 2146
@132mhz 536
@24mhz 97
T3.6@256mhz 659 1120 Fastest+pure+LTO
T3.6@180mhz 434 287 Faster
T3.6@120mhz 289 191 Faster
T3.5@120mhz 261 138 Faster
T3.2@120mhz 254 106 Faster
adaM4F@120mhz 272 168 -O2 SAMD51
STM32L4@80mhz 208 63
coremark compiler optimizations (iterations/sec) 1062@600MHz
Teensy4 Teensy4 NXP SDK
gcc compiler 5.4.1 7.3.1 7.2.1
-O3 2427.4 2394.7 2439.2
-O3 -funroll-loops 2563.2 2564.9 2626.7
-O3 -funroll-all-loops 2659.4 2625.4 2673.3
Speed test
----------
F_CPU = 396000000 Hz
1/F_CPU = 0.0025 us
The next tests are runtime compensated for overhead
nop : 0.003 us
Arduino digitalRead : 0.089 us
Arduino digitalWrite : 0.069 us
pinMode : 0.214 us
multiply volatile byte : 0.017 us
divide volatile byte : 0.027 us
multiply volatile integer : 0.015 us
divide volatile integer : 0.027 us
multiply volatile long : 0.017 us
multiply single float : 0.012 us
divide single float : 0.039 us
multiply double float : 0.022 us
divide double float : 0.052 us
random() : 0.102 us
bitSet() with volatile : 0.013 us
analogRead() : 18.002 us
analogWrite() PWM : 0.282 us
delay(1) : 1000.002 us
delay(100) : 100000.002 us
delayMicroseconds(1) : 1.017 us
delayMicroseconds(5) : 5.021 us
delayMicroseconds(100) : 100.002 us
you mean this:Probably another case, like I was running into that the constructor and the like may not be called...
Paul mentioned this as regard to my test around #178 and #180.
Yeah, I have this bad tendency to call everything with the C++ a compiler issue guess I have to get out of that habit.Maybe it's all that C++ stuff I didn't put into the linker script yet?
Or could be the C++ constructor init stuff missing in setup.c?
317 528 528 532 532 533 533 533 533 534 535 537 537 540 540
#define HW_SERIAL Serial4
uint32_t SFirst = 0;
uint32_t ii = 0;
elapsedMillis noDelay;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite( LED_BUILTIN, HIGH );
Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
HW_SERIAL.print( " millis=" );
HW_SERIAL.println( millis() );
Serial.print( " millis=" );
Serial.println( millis() );
while ( !Serial ) {
Serial.println( millis() );
ii++;
}
Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
SFirst = millis();
Serial.print( " Serial First millis=" );
Serial.println( SFirst );
Serial.print( " while Count ii=" );
Serial.println( ii );
delayMicroseconds( 100 ); // test of Cycle Counter Active
ii = 0;
noDelay = 0;
}
bool flip = true;
void loop() {
ii++;
if ( noDelay > 1000 ) {
noDelay -= 1000;
digitalWrite( LED_BUILTIN, flip );
flip = !flip;
HW_SERIAL.println( ii );
ii = 0;
}
}
System Clock: 600000000
IPG Clock: 150000000
RTC Clock: 32768
USB1pll Clock: 480000000
Peripheral Clock: 24000000
Osc Clock: 24000000
Arm Clock: 1200000000
Semc Clock: 200000000
Usb1PllPfd0 Clock: 360000000
Usb1PllPfd1 Clock: 246857130
Usb1PllPfd2 Clock: 332307684
Usb1PllPfd3 Clock: 576000000
Usb2Pll Clock: 24000000
SysPll Clock: 528000000
SysPllPfd0 Clock: 396000000
SysPllPfd1 Clock: 396000000
SysPllPfd2 Clock: 500210514
SysPllPfd3 Clock: 396000000
EnetPll0 Clock: 0
EnetPll1 Clock: 0
AudioPll Clock: 0
VideoPll Clock: 0
Maybe already reported, but Serial.read/Serial.available() not working --- hanging.
I have to hit the program button after most uploads ??
#define NO_WFI 1
#define HW_SERIAL Serial4
#define sleep_cpu() ({__asm__ volatile("wfi");})
IntervalTimer ITtest;
volatile uint32_t jj = 0;
//volatile uint32_t jj = 996;
void TimeSome() {
jj++;
}
elapsedMillis noDelay;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite( LED_BUILTIN, HIGH );
while ( !Serial );
Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
ITtest.begin( TimeSome, 1000);
noDelay = 0;
}
bool flip = true;
void loop() {
if ( noDelay > 1000 ) {
noDelay -= 1000;
digitalWrite( LED_BUILTIN, flip );
flip = !flip;
HW_SERIAL.print( "ITcnt=" );
HW_SERIAL.println( jj );
HW_SERIAL.print( "micros=" );
HW_SERIAL.println( micros() );
jj = 0;
//sleep_cpu();
}
#ifdef NO_WFI
if ( jj<995 )
#endif
sleep_cpu();
}