November 22, 2024, 06:53:24 PM

MOD-TC-MK2-31855 firmware v3 bug

Started by lambda, May 16, 2016, 08:56:46 PM

Previous topic - Next topic

lambda

Hi,

I recently started to look into MOD-TC-MK2-31855. Reading the TC works well (from some olinuxino board).

However reading the analog inputs (10bit ADC) only gives poor results - see this image http://friends.ccbib.org/lambda/adc.png for an example: This should be a continuous temperature curve, but you see huge jumps, ie lots of missing codes. For example the codes in the range 448-460 and 512-523 and many odd codes like 463, 471, 495, 527, 559, 631 and also some even codes like 544 are missing from the output.

A quick glance at the firmware code suggestes that this is caused by complete disregard of the timing requirements stated in the PIC16F1503 data sheet. However I don't have the toolchain to compile the firmware for the PIC so I can't check myself. I think the following changes would improve the results:
* switch the clock source of the ADC to FRC, ie: ADCON1bits.ADCS = 7
  (or alternatively since the ADC is running at 16MHz it seems use FOSC/16, ie: ADCON1bits.ADCS = 5
* after channel selection wait for the acquisition time (see section 15.4 of the data sheet)
* maybe put the PIC to sleep during the ADC conversation to reduce noise. (Only possible with FRC)

On a separate note: The product page of MOD-TC-MK2-31855 says FEATURES -> Thermocouple connector - however I only see a screw terminal on what I got. I think putting the TC plug into the screw terminal is a bad idea and it doesn't fit anyway. Should there have a cable with TC connector been included into the package? Did I missunderstand something? - Either there is an error or it is not obvious what is meant. (Not a big deal: I just removed the TC plug and put the wires into the terminal, but I'm mentioning this for completeness.)

Harald

LubOlimex

#1
Hey man,

Thanks for the input. We did some changes. Can you test if this behaves better (before I put it in all MOD-TC-MK2-31855 units and on the web-site): https://drive.google.com/open?id=0BwplT87k9SCgTmUtajJXWExsOFk

"Thermocouple connector" doesn't specify what type of connector there is. It is visible that it is a screw terminal. The idea behind the description is to show that there is "some" connector - not just PCB pads or pin holes. Also consider that the thermocouple TC-K-TYPE that we sell fits in the screw terminal.

Looking forward to your feedback.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

lambda

Quote from: LubOlimex on May 19, 2016, 03:39:53 PM
Thanks for the input. We did some changes. Can you test if this behaves better (before I put it in all MOD-TC-MK2-31855 units and on the web-site): https://drive.google.com/open?id=0BwplT87k9SCgTmUtajJXWExsOFk

Thanks for the quick action. I got the files and am looking into how to update the firmware in the device.
I have one of your PIC-PG1 adapters but it looks like the two free software programmers out there (picprog and PiKdev) both don't support PIC16F1503 yet. I'm dicussing with the upstream authors how to get this chip supported.

This may take a while. (Both answered basically: "Feel free to ask any questions, but you will need to do the work yourself.)

Quote
"Thermocouple connector" doesn't specify what type of connector there is. It is visible that it is a screw terminal. The idea behind the description is to show that there is "some" connector - not just PCB pads or pin holes. Also consider that the thermocouple TC-K-TYPE that we sell fits in the screw terminal.

Actually part of my point was that the TC-K-TYPE I got from you doesn't fit into the screw terminal of the board I got from you. (didn't try big forces or anything that permanently deforms the plug of course.)

I think if you change "Thermocouple connector" to "screw terminal for thermocouple" it would be less confusing.

Thanks,
Harald

lambda

Looks that for adding PIC16F1503 support to PiKdev, I need a file PIC16F1503.dev from recent MPLAB X. I don't have a system suitable for running their installer available atm. Can somebody send me this file?

The following chips use the same programming specification so could be supported at the same time:
• PIC12F1501 • PIC12LF1501
• PIC16F1503 • PIC16LF1503
• PIC16F1507 • PIC16LF1507
• PIC16F1508 • PIC16LF1508
• PIC16F1509 • PIC16LF1509

If somebody could send me the *.dev files for all these chips that would help even more.

TIA,
Harald

JohnS

I don't think there are any such files - there aren't in what I have installed.

You may want the info in devIDs.txt from http://www.microchip.com/forums/download.axd?file=0;817886

John

lambda

Quote from: JohnS on May 24, 2016, 05:26:47 PM
I don't think there are any such files - there aren't in what I have installed.

strange. I will need to find them somewhere else then.

Quote
You may want the info in devIDs.txt from http://www.microchip.com/forums/download.axd?file=0;817886

This file references the *.dev files, but doesn't include all the information. Also I need the information in *.dev format, for PiKdev to parse it.

Thanks for checking anyway.

Harald

LubOlimex

Hey,

I also checked both MPLAB X installations that I have (versions 3.15 and 3.30) and I couldn't find any *.dev files inside.

Did you try this software PICPgm? It seems to work with PIC-PG1 and PIC16F1503. It also seems to have Linux version. I found it here but haven't tested it so be careful: http://picpgm.picprojects.net/download.html

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

lambda

Quote from: LubOlimex on May 26, 2016, 02:58:21 PM
I also checked both MPLAB X installations that I have (versions 3.15 and 3.30) and I couldn't find any *.dev files inside.

Thanks for the confirmation. I wrote the author of PiKdev a mail and pointed him to this thread. Maybe he can give some input. However if we can't get this *.dev files, I will focus on getting support into picprog instead.

Quote
Did you try this software PICPgm? It seems to work with PIC-PG1 and PIC16F1503. It also seems to have Linux version. I found it here but haven't tested it so be careful: http://picpgm.picprojects.net/download.html

I saw this when looking for programmers, but it looks like no source code is available. :-(

On the only machine with proper RS232 interface that I still have in use, running untrusted binaries is off limits.

The other alternative that I might look into is pk2cmd from Microchip. It is not free software but at least it is open source. However I'm unclear if it works with JDM programmers. Also it seems that this software is discontinued by Microchip, so not the best choice either.

I'd rather spend my time on getting support into proper free software than on setting up some work around with non-free tools.

best regards,
Harald

lambda

Hi,

some updates on this:

I think I have a code for pikdev, that should mostly work. However
I can't even read the device id from the part. No matter what I
try, the programmers always report that no device is present.

Things tried:
Reading the device id with picprog with various timings and PIC-PG1
  Result: JDM Programmer detected, PIC not detected
Reading the device with picpgm as recommended above and PIC-PG1
  Result: As before
Reading MOD-RS485-ISO with above setups
  Result: As before
Reading an old PIC16F874 with picprog and a custom 40pin programmer
  Result: Works!!!
Connecting MOD-TC-MK2-31855 to my custom programmer
  Result: The same as with PIC-PG1 - I tripple checked the wiring,
  but maybe I got something wrong anyway.
After all attempts connect MOD-TC-MK2-31855 to my Olinuxino board
and read the sensors.
  Result: The MOD-TC-MK2-31855 still works as before.

Conclusions:
* I haven't bricked my MOD-TC-MK2-31855 yet.
* The serial port I'm using is JDM compatible.
* I will debug this further once I have time to mess with an
  oscilloscope.
* I don't have an estimate when I will be able to test your
  firmware update.

Possible explanations:
* The PIC-PG1 I have is broken in some subtle way. It's a
  shiny new part never used before, so this is unlikely but
  possible.
* PIC-PG1 is not compatible with PIC16F1503. -> I don't
  know anything about this.
* PIC16F1503 has some strange timing requirements and I never
  managed to actually enter programming mode. I tried lots of
  different timings, so this is very unlikely.

I will debug this further once I have time and access to some
proper lab with an oscilloscope. However if anybody has an
idea of what might be wrong or any other advice: Please help
me! :)

If somebody could confirm that PIC-PG1 can at least read the
(pic) device id of MOD-TC-MK2-31855 with one of the free
software programmers of picpgm or any other software, this
would be helpful too.

Thanks,
Harald

lambda

Looks like my PIC-PG1 is dead on the clock line...

I still don't know why it doesn't work with my home-build programmer - maybe it runs into some current limit or maybe I destroyed the MCLR pin:
It seems that my PIC-PG1 emits Vpp of 13.8V while the PIC16F1503 states an absolute maximum rating of 9V

Anyway: Looks like I can't test your changes to the firmware. Sorry about that.

best regards,
Harald

lambda

Hi Lub!

Finally have been able to upload your firmware (with an A20-Olinuxino-micro and a custom built gpio programmer)!

I ran some tests (one and two ADC inputs) and it looks quite good: Not all symbols are distributed completely even (ie some symbols are more likely to be reported then others) but I did see all symbols (tested most of the entire voltage range).

I recommend putting this firmware on the web site and using it for newly assembled products. (And updating the modules in stock, if feasable.)

I notice that the .hex file you provided in this thread is quite different from the file linked from the product page. I guess this is due to different compilers being used.

Harald

lambda

What's the status of this? I still don't see the fixed firmware on the website...

If I order more MOD-TC-MK2-31855, will I get items with fixed firmware?

TIA,
Harald

LubOlimex

Hey,

Thanks for the notification. We have implemented the changes in our production an year and a half ago. All units manufactured after 01.12.2016 should have the new firmware.

The firmware and the source are now available here: https://www.olimex.com/Products/Modules/Sensors/MOD-TC-MK2-31855/resources/MOD-TC-MK2_firmware_OLinuXino_v4.zip

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex