Jump to content

All Activity

This stream auto-updates     

  1. Last week
  2. This really is a nice little program to confirm operation of the xpress board! I forgot to check the stdio redirect option in for the eusart module in MCC and so was stuck for a couple minutes! One question is with regard to how the uC is programmed. Does the program go into ram on the xpress board? I have not looked in depth yet, but the program seems to go away when the board restarts. Keith
  3. Earlier
  4. I followed your instructions step by step. Finally, downloaded SimulatorUART.zip to run. You say "If you run this code in the simulator it will open an additional output window which will show the output from the UART as follows", but my screen doesn't prompt out "UART 1 output" window. So I still cannot see printf() result. My MPLAB X IDE version is 5.35, XC8 is 2.20. And I don't install CCS C Compiler in MPLAB X IDE plugin. Could you help me to figure out my problem. Thank you!
  5. I would also suggest you take a look at this because you seem to be writing to the port register bits which will cause read/modify/write errors. Is it possible that the pin is actually toggling really fast?
  6. Hi! I'm not sure that's happening, maybe we can find this together. First, check out this thread about PORT and LAT: If you like to set an output, use LAT registers instead of PORT. Second thing is your code: Is it your intention that variable c is going negative? if (PORTAbits.RA1 == 0) { if (c1_m1 == 1) { c--; c1_m1 = 0; } } You used an "int" type, which means c is a signed 16 bit integer. You could use more explicit types like "int16_t" and check if your code regards the negative case properly. Third thing I noticed: Your while() loop is running with maximum speed. It may be better to have a timing in your main sequence to get a more predictable runtime. For example, just add Timer0 to your main loop: // configure TMR0 according to datasheet, section 20.2 OPTION_REG = 0b11010011; while(1) { // wait here for next cycle while(INTCONbits.TMR0IF == 0); INTCONbits.TMR0IF = 0; // execute cyclic code // ... } About your floating output: How did you measure this? If you have used a multimeter, you likely are measuring the RMS value of a rapidly changing digital output. The TMR0 helps you getting a deterministic behavior, a scope helps you seeing what is really going on... And did you halt the code at certain points and observed the behavior of your pins? With a PICKit or any other debugger attached to your controller, just run a debug session and set a breakpoint where you expect bad things to happen 🙂
  7. Hey guys, I am developing a project with the PIC16F1826 and one of my outputs is flotoating like 1.9V, 2.9V and I can´t find why. I already check the ANSEL registers and initialize the PORTs at 0. It start´s when I add more if statements in my checkmodule() function... Here is the code: int c=0; int c1_m1 = 0; int c1_m2 = 0; int c1_m3 = 0; void main(){ OSCCON = 0b01110000; ANSELA = 0b00000000; ANSELB = 0b00000000; TRISA=0b11111111; PORTA = 0b00000000; TRISB=0b00000000; PORTB = 0b00000000; while(1){ checkmodules(); module_status(); } } void checkmodules(){ if(PORTAbits.RA1==1){ if(c1_m1==0){ c++; c1_m1=1; } } if(PORTAbits.RA1 == 0){ if(c1_m1 == 1){ c--; c1_m1 = 0; } } // When I add mores of this if´s, I start to have the problem with my PORTB outputs... } // end checkmodules() void module_status(){ if(c>0 && c<=3){ PORTBbits.RB4 = 1; } if(c==0){ PORTBbits.RB4 = 0; } if(c>=3){ PORTBbits.RB5 = 1; } if(c<3){ PORTBbits.RB5 = 0; } }// end module_status()
  8. Please check VDD voltage, this dsPIC needs at least 4.5V to do a bulk erase. If it's lower, erasing step will fail.
  9. When that happens it usually indicates something wrong with the connection to the device. The strengths of the pin drivers are not the same on the different programmers. Perhaps you have marginal amounts of capacitance on the lines?
  10. I am trying to program dspic30f with pickit4 and using MPLAB X IDE 5.40, on programming it shows Erasing...Verify failed. [config mem] 0x2007, expected 0x1ff, got 0x44Programming did not complete. but it's ok if i use pickit2 to programing
  11. I was not able to create a satisfactory workaround on the A1 or A3 Silicon. We were able to get Rev B2 Silicon which resolves the problem. The official workaround on A1 silicon is not to use the peripheral but instead to bit-bang the I2C. From the Errata:
  12. This is a user help forum for all topics on engineering and embedded software development. Feel free to browse the articles, ask questions and enjoy the fellowship of fellow embedded engineers. Welcome to the group.
  13. How do i start here and what to do ?/
  14. Hi, I am also getting the same problem . I2C is randomly hanging in checking for IDLE state and i checked for flags where ACKEN =1. So i applied reset sequence(9 clock pulses) and bus become IDLE. Now the problem is after some time , Read Time Out errors is coming i.e RBF = 0. I2C Receive buffer(I2C3RCV) is not filled completely. Even i reset with a relay the I2C master is still in the same state. what to do to get out from this problem? Please help.. Controller: PIC32MZ1024EFH144 IDE: MPLABX IDE v5.10 Silicon Version: A1
  15. Thanks for pointing out the mistake, I have updated the post to show 2.0 LSB which is the correct Offset error for this device
  16. Thank you so much for this helpful document. In the offset error section; you first say the offset error is 2.5 LSB but then you mention it as 0.5 LSB typical and 2.0 LBS at max. This made me confused a little bit
  17. This is a quick note to warn everyone using the SAMD21 in an Arduino environment with the STL. I use C++ all the time and much of the power comes from using the STL. Vector, queue. array, etc are all canned, powerful libraries that make your life easier. However, the Arduino runtime environment for the SAMD21 conflicts with these libraries. Here is a quick example: #include <Arduino.h> #include <vector> using namespace std; vector<int> count; void setup() { Serial.begin(115200); count.push_back(0); } void loop() { Serial.println("Hello"); delay(500); } A trivial use of a vector to burn up all the RAM. Simply including the vector causes a conflict with the implementation of min(a,b) Building in release mode Compiling .pio/build/mkrzero/src/main.cpp.o In file included from /Users/joejulicher/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/7.2.1/vector:60:0, from src/main.cpp:3: /Users/joejulicher/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/7.2.1/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2 min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /Users/joejulicher/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/7.2.1/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2 max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ In file included from src/main.cpp:2:0: /Users/joejulicher/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/7.2.1/bits/stl_algobase.h:195:5: error: expected unqualified-id before 'const' min(const _Tp& __a, const _Tp& __b) ^ /Users/joejulicher/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/7.2.1/bits/stl_algobase.h:195:5: error: expected ')' before 'const' /Users/joejulicher/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/7.2.1/bits/stl_algobase.h:195:5: error: expected ')' before 'const' The implementation of min for Arduino conflicts with the implementation for the STL. I have done this same build with ESP32 and STM32 and did not have these conflicts. Therefore these are SAMD21 "features". Fortunately you can easily work-around the issue by reversing the include order. Put vector (or other STL's) before the Arduino.h and it compiles just fine. Of course I have not exhaustively tested this combination so your milage may vary. Good Luck
  18. In case anyone was curious, and pictures or it did not happen. Here is the completed data collection unit. The engraving was with my laser. The PCB image is really a ChipKit (just a handy DXF I had). Unfortunately the laser water flow sensor had a leak so the tube overheated and lost power most of the they through the engraving. This has all been fixed and apparently no permanent damage. Oh well. It still looks nice. Front and back panels are laser cut acrylic. Blue extrusion is from here: https://www.amazon.com/dp/B07MPX23FS/ref=cm_sw_em_r_mt_dp_U_QPQ4Eb3MH0BNX The mounting flanges are these: https://www.amazon.com/dp/B07MZPFWKK/ref=cm_sw_em_r_mt_dp_U_BQQ4Eb6BE926B
  19. Great idea! Add a magnetic RFID receptacle, then you can set different scenarios by throwing a token against the outside of the trailer. Like Ambient, Astro, Work, Essential only... 😎
  20. I have decided that I need dimmable lights in the cabin and the ability to load shed in a low power situation. The next feature will be a smart fuse block with individual BPS443 power switches for each circuit. Then I can turn off the refrigerator and dim the cabin lights at the fuse panel. Normally that would not be fantastic but in this case I simply want to bias the lights down a few percent so this will be fine. I won't use the SAMD21 for this project for other reasons which I will write about.
  21. Setting ANSEL just disables the digital input. So with ANSEL set to 1, you'll get back 0 regardless which voltage is applied. If you want to make analog measurements, it's a good idea to disable the digital input. Otherwise it'll begin to toggle between 0 and 1 all the time if the voltage is in the forbidden zone (between low and high level). Back when PICs didn't have a dedicated LAT (latch) register, leaving the ANSEL at 1 had a serious side effect: This is from an old PIC16F887. If ANSEL was left at 1, PORT would be always zero. You could still set the output stage to 1 or 0, but you would always read back 0. This leads to a RMW (read-modify-write) problem. To change a particular pin, you had to read out the PORT register for an entire bank, modify the bit for your pin and write it back. If a pin has ANSEL set, it'll return 0, although the output is actually 1. With the write back operation, this pin will be set to 0. So you want to set RA3 to 1, but RA5 (with ANSEL set) gets cleared mysteriously at the same time.. This lead to day-filling debugging sessions and lot of grey hair, so many people still yell "Set ANSEL to zero!!" if you use it as a digital output pin. For modern PICs, this isn't a problem anymore: These devices have a latch register, where you set the logic state for the output buffer. The digital read back is separated, its still available in PORT. If you leave ANSEL set to 1, it'll only affect the PORT register now, LAT is independent from the actual voltage at the pin. Long story short: For modern PICs, you can leave ANSEL set to 1 for digital outputs.
  22. Nice project! How about adding some non-Victron nodes like environmental sensors to the system? Good to see you've thrown out that old lead battery, LiFe batteries are so much better! I have mine for 2 years now and it still has full (60 Ah) capacity. Discharged it twice down to 9.8 V, nothing happened.
  23. Exactly! Lots of serial ports can be very useful in a variety of situations. Using these serial ports in the Arduino environment had a few challenges that the standard tutorials did not completely cover so I hope the Arduino SERCOM information I provided here is useful.
  1. Load more activity

  • Popular Contributors

    Nobody has received reputation this week.

  • Who's Online (See full list)

    There are no registered users currently online

  • Forum Statistics

    • Total Topics
    • Total Posts
  • Create New...