Jump to content
 

All Activity

This stream auto-updates     

  1. Earlier
  2. 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:
  3. 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.
  4. How do i start here and what to do ?/
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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... 😎
  11. 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.
  12. 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.
  13. 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.
  14. 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.
  15. Hi...when we first checked out the ATSAMD21 chip, we were very happy to see that the chip has 6 "SERCOM"s, a.k.a SERial COMmunication modules. Each one of these modules can be used for I2C, SPI or Serial. That means you can have 3 UART's & 3 SPI's, or maybe 2 SPI's and 4 I2C's. Basically, you have a ton of options for adding more hardware support for the most common 3 chip-to-chip protocols.
  16. The ANSEL and the TRIS registers work independently of each other. The RESET condition for both registers is ANALOG (all bits set) and INPUT (all bits set). This is not simply because all registers should be set to 1's (no true and not done) but rather, the lowest power/safest state of the device would be analog input followed by digital input because chip cannot know what is attached to each pin. Because ANSEL and TRIS are independent, you get some interesting side behavior. i.e. MCC always defaults to the reset state for each register. ANSEL does not impact the pin's ability to be an output (if you write to the LAT register) so leaving ANSEL set is safe but strange. In fact, it is possible to make an ADC conversion on an output pin and see how the pin is behaving (is it over loaded or charging a capacitor). I suppose the short answer is, setting the pin to output did not require disabling the analog feature so MCC did not do that.
  17. Ok, so every time I set up a pin as an output MCC insists on making it "Analog". It looks like this setting has something to do with the ANSEL register, but surely an output is not Analog so why do they do this?
  18. I am working on a project for my camping trailer. The trailer has a 200W solar panel charging a 100AH LiFe battery. This crazy amount of energy is used to run lights, a refrigerator and, more importantly, a laptop and telescope while I am in the field. There is the trailer stored in the yard. The grey metal on the front is a set of drawer slides holding the 200W 24v panel. The 24v works well for the MPPT's because I get charging voltage earlier in the morning. The 200W works well because I don't want to move the panels to track the sun while I am camping. Now I want a status panel for the entire trailer in my home office so I can see how prepared I am for camping at moments notice. When I bought the trailer I specified a custom electrical system. This system utilizes a lot of Victron Energy equipment because it works well and it has a serial port with a published specification. They even show off open source projects using their equipment. Here is the electrical box. It did get a bit tight. Each of the blue units is a device with serial data for monitoring. This box lives in the black equipment box on the trailer tongue. The serial port is called VE.Direct and it is a simple 1 second transmission of useful information at 19200 baud. Here is an example of a transmission recorded from the trailer. PID 0xA053 FW 146 SER# HQ1734RTXXT V 13500 I -180 VPV 39200 PPV 0 CS 5 MPPT 1 OR 0x00000000 ERR 0 LOAD ON IL 200 H19 2436 H20 21 H21 106 H22 27 H23 132 HSDS 117 Checksum $ I decided that step 1 in my project is to collect the data from the 3 devices in the box and report them to a second human interface/radio link in the back of the trailer. Here is my plan: This indicates that I need an MCU that has 5 serial ports and is easily programmed for my Hobby. I have been doing quite a bit of Arduino work in Platform IO and that combination is pretty good so how about using one of the many SAMD21 based Arduino kits. The SAMD21 has 6 SERCOM's that can be used for this purpose. So the first step... How easy is it to use 5 of the SERCOM's to do what I want? Not too bad but there are a few gotcha's. The SAMD21 Arduino support has a file called variant.cpp that defines a big array of structures to cover the capabilities of each pin. This structure includes a "default configuration" setting such as SERCOM, Analog, Digital, Timer, etc... When you open the serial port (Serial.begin(19200)) the serial library puts the pins into the "default" behavior and not the SERCOM behavior. Therefore if you want to use multiple sercom's you must do a few steps. 1) Ensure your SERCOM is initialized with the correct I/O pins. Uart ve1(&sercom2, sc2_rx, sc2_tx, SERCOM_RX_PAD_3, UART_TX_PAD_2); Uart ve2(&sercom3, sc3_rx, sc3_tx, SERCOM_RX_PAD_1, UART_TX_PAD_0); Uart ve3(&sercom1, sc1_rx, sc1_tx, SERCOM_RX_PAD_3, UART_TX_PAD_2); Uart ve4(&sercom4, sc4_rx, sc4_tx, SERCOM_RX_PAD_1, UART_TX_PAD_0); The tricky bit here is mapping the Arduino PIN number, to the SAMD21 Port/PIN numbers so you can determine which portmux settings are applicable. This is helpfully documented in the variant file but it is tedious especially since I build a custom PCB and had to keep track of every abstraction layer to ensure I hooked it up correctly. 2) Start the UARTS. ve1.begin(19200); ve2.begin(19200); ve3.begin(19200); ve4.begin(19200); This step was VERY simple and straight forward. 3) Put the new pins in the correct mode. pinPeripheral(sc1_tx, PIO_SERCOM); pinPeripheral(sc1_rx, PIO_SERCOM); pinPeripheral(sc2_tx, PIO_SERCOM); pinPeripheral(sc2_rx, PIO_SERCOM); pinPeripheral(sc3_tx, PIO_SERCOM); pinPeripheral(sc3_rx, PIO_SERCOM); pinPeripheral(sc4_tx, PIO_SERCOM_ALT); pinPeripheral(sc4_rx, PIO_SERCOM_ALT); The begin() function put each of these pins in their DEFAULT mode according to the variant table. But most of these pins did not have PIO_SERCOM as their default mode. You must call pinPeripheral() after you call begin() OR change the variant table. Naturally, my initial code did not but things did not work. Since I am working on this project off and on for some time, I found the bug in my VE.Direct class! The constructor was issuing the begin() which does make sense but it breaks the UART configuration that was already up and running. Now my serial ports are all running, and I am playing recorded messages to the system so I can debug inside where it is not 40C. On to the next problem. Good Luck
  19. I just received a care package from my father with a pile of old "junk". In there was a Speak and Spell from around 1978, I don't know when mine was bought. I quickly checked the battery compartment (4 C-cells) fearing to find a pile of corrosion. I did, but it was the rusty sort. The battery contacts were rusted. I opened the unit, removed the contacts and dropped them in vinegar to dissolve the rust. The contacts completely fell apart. A quick Amazon order for Keystone 209's and I was back in business. The new clips seem to be slightly thicker or perhaps stiffer, as the batteries are more difficult to insert. BUT it works! While I was waiting for the 209's to arrive, I considered adding an 18650 battery and a USB battery charger. The old TMS5100 series electronics runs from -15v so there is an inverting boost regulator to drop the 6v down to the -15. I tested and this works OK from 5v which is the standard output from the variety of battery manager/chargers you can find. But in the end I did not want a second button to activate the USB battery and then the normal ON button to activate the device. In any case, my 5 year old son loves it, though he did ask "can we install more games".
  20. Orunmila

    Ms

    If you load that project it should load with the working version.
  21. Orunmila

    Ms

    Here is the project I generated, sorry for the random name 🙂 wdqwd.zip
  22. Orunmila

    Ms

    I tested it and from v1.80.0 of the PIC10/12/16 library onwards this seems to be broken. If you open the "Versions" tab and find the previous version it still works fine. You can switch to the old version in the IDE. It looks like this on my machine. Right-click on the 1.78.1 version and select Mark library for load and then press the load button at the top next to where it says "Versions" it will appear. After doing this I bet it will work just fine. It builds. I will attach the project for you also.
  23. Orunmila

    Ms

    Sounds like a bug in the latest MCC, have you tried an older version?
  24. N9WXU

    Ms

    It is pretty hard to use on my 4K monitor as well.
  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
      79
    • Total Posts
      369
×
×
  • Create New...