PO2013 - Real time measurement
Hi, I wish to do some real time input from basic sensors. This discipline is well established with so called home automation, developed through Arduino project, see MySensors lib, etc. [a] Arduino can do A/D conversions for Oberon while it can talk over WiFi, the same WiFi, PO2013 was designed with, more sensors can be linked in a HUB. [b] PIC processors can also do A/D conversion. PIC can possibly interconnect through GPIO, while I cannot see an easy way to add more devices to the hub (* multiplexing GPIO input???*). It also has some leverage in NW's PICL project. Both options require some more studying and understanding on my part. Generally what is your experience, recommendations to pursue [a], [b] for PO2013? Many thanks -- Tomas Kral <thomas.kral@email.cz>
Hi Tomas,
I wish to do some real time input from basic sensors... [a]... Arduino can do A/D conversions for Oberon while it can talk over WiFi,
Just to be clear, the nRF24L01 chips used with Oberon on the FPGA do not do WiFi, but they use the same 2.4GHz bands. Other chips can do WiFi.
[b]... PIC processors can also do A/D conversion. PIC can possibly interconnect through GPIO, while I cannot see an easy way to add more devices to the hub (* multiplexing GPIO input???*). It also has some leverage in NW's PICL project.
I would definitely recommend PIC. I have successfully used the PIC16F1455 (5V), the PIC16LF1455, and the PIC16LF1459 (both 3.3V) as well as some of the older chips, even the PIC16F84 which is the replacement for the PIC16C84 Prof. Wirth refers to on his PICL page. His PICL compiler targeted this PIC16C84 which is quite a bit simpler than modern PICs, which have A/D, D/A, signal generation, PWM, even USB (device) but at least with the PICs, the added complication is only due to the added features. :) Nevertheless I found it very easy to extend the compiler to add features for modern PICs (e.g. bank-switching) and in many cases such large changes wouldn't even be necessary. Prof. Wirth also provides an example of using a PC parallel port to control (multiplex) two PIC chips, which you could easily adapt for the FPGA. The main thing to remember is that with the FPGA you will want to use the 3.3V versions (LF) not the 5V versions (F). Having done a lot of nRF24L01 programming, you should also be very well placed to connect a PIC SPI port directly to the nRF24L01 module, programmed in PICL, to create a remote self-contained "sensor node", if you wish. I thought of doing this using an MSF radio-controlled clock for the timeserver in the ETH classes, but time did not allow (no pun intended!), and a Raspberry Pi or a PC serves just as well in practice. Let me know if I can help further. Best regards, Paul
Hi Paul, Thank you, while digesting your reply. This quick caught my attention.
Having done a lot of nRF24L01 programming, you should also be very well placed to connect a PIC SPI port directly to the nRF24L01 module, programmed in PICL, to create a remote self-contained "sensor node",
How about extending board's SPI socket, into a sort of cable bus, devices put on a ribbon cable. Then question remains, how to address the nodes using distinct CS signal for each, also not sure what length of ribbon cable could SPI handle. It is meant just for sensor logic in immediate vicinity of FPGA board. The analog signals will be carried by longer cables to actual sensors / probes. -- Tomas Kral <thomas.kral@email.cz>
How about extending board's SPI socket, into a sort of cable bus, devices put on a ribbon cable. Then question remains, how to address the nodes using distinct CS signal for each, also not sure what length of ribbon cable could SPI handle. It is meant just for sensor logic in immediate vicinity of FPGA board. The analog signals will be carried by longer cables to actual sensors / probes.
It's wise not to be too general about this but just design for some specific examples. I2C attempts to solve the multiple-select-line problem by having devices respond to a (sometimes-configurable) address instead, but I2C is much more complicated than SPI (in implementation more than in use). Long analogue lines are usually avoided, because of the possibility of interference and attenuation. Hence I suggested radio as being much easier nowadays; but you could use e.g. RS485. Tradeoffs for distance vs baudrate are usually made; in the case of sensors this is not usually a problem. HTH Paul
On Sun, 16 Dec 2018 18:24:49 +0000 Paul Reed <paulreed@paddedcell.com> wrote:
It's wise not to be too general about this but just design for some specific examples.
Yes, now I see. I was tempted to operate `CS' through `GPIO', Oberon doing device multiplex in S/W. SPI ribbon cable some 10-20 cm max? Reading about SPI over RS485, now. SPI is probably meant single device connection. nRF therefore appears obvious signal transport means. My experience with PIC is so far minimal, assembly language only. PIC SPI port, is this a real port featured by some PIC models, or just a program driver operating on PIC I/O signals doing SPI protocol? -- Tomas Kral <thomas.kral@email.cz>
My experience with PIC is so far minimal, assembly language only. PIC SPI port, is this a real port featured by some PIC models, or just a program driver operating on PIC I/O signals doing SPI protocol?
https://www.microchip.com/wwwproducts/en/PIC16F1459 HTH Paul
Tomas: SPI is a bidirectional bus meant for communication between a single bus master (e.g., Oberon System) and multiple slaves, one slave at a time. You can connect as many slaves to the ribbon as you wish, but you can only communicate with a single slave while others are not active. A small variation of this scheme is when you only send data out from the master to all slaves, without slaves returning their responses. The cable can be of any length, but you need to tune the clock frequency to the cable and the driver chip, such that the voltage levels have enough time to settle. The clock can be of any frequency. You can drive a very long cable, if you can accept slow performance. There are few if any driver chips which would be specifically SPI. The reason is that SPI is not meant to be driven over long distances, and a short SPI run can be driven by any chip. If you want to use long cable runs, esp. in a harsh environment, then RS-485 or CAN are much better because their drivers are specified for doing just that. In particular, a long cable can pick up a large common mode, which the RS-485 or CAN can cope with. Another such standard is RS-232, where the signal immunity is achieved by brute force with signals of a large amplitude. RS-232 is single ended, but its amplitude is so large that even a substantial noise pickup can be tolerated. (Note that RS-485 is differential, which is achieving the same goal using a different approach.) You can learn a lot about building such systems from a very popular book "The Final Word on the 8051" by Matthew Chapman. The PDF is very easy to find on the net and worth reading. Hope it helps, Wojtek ________________________________________ From: Oberon [oberon-bounces@lists.inf.ethz.ch] on behalf of Tomas Kral [thomas.kral@email.cz] Sent: Sunday, December 16, 2018 1:51 PM To: oberon@lists.inf.ethz.ch Subject: Re: [Oberon] PO2013 - Real time measurement On Sun, 16 Dec 2018 18:24:49 +0000 Paul Reed <paulreed@paddedcell.com> wrote:
It's wise not to be too general about this but just design for some specific examples.
Yes, now I see. I was tempted to operate `CS' through `GPIO', Oberon doing device multiplex in S/W. SPI ribbon cable some 10-20 cm max? Reading about SPI over RS485, now. SPI is probably meant single device connection. nRF therefore appears obvious signal transport means. My experience with PIC is so far minimal, assembly language only. PIC SPI port, is this a real port featured by some PIC models, or just a program driver operating on PIC I/O signals doing SPI protocol? -- Tomas Kral <thomas.kral@email.cz>
You can connect as many slaves to the ribbon as you wish, but you can only communicate with a single slave while others are not active.
Wojtek, Thank you, I wanted to achieve a small system bus for Oberon devices, inexpensive, with as few components as possible. I learnt SPI cannot be addressed, but only chip selected by `CS'. My idea was to drive `CS' by Oberon through `GPIO' + interrupt, being a master letting only one party to talk, the other listen, at at time. Thus having a simple HUB, for some A/D sensors. Alternatively to have also D/D, D/A outputs. Designing a small control system, so to speak. -- Tomas Kral <thomas.kral@email.cz>
On 12/17/2018 1:10 AM, Tomas Kral wrote:
You can connect as many slaves to the ribbon as you wish, but you can only communicate with a single slave while others are not active. Wojtek,
Thank you, I wanted to achieve a small system bus for Oberon devices, inexpensive, with as few components as possible. I learnt SPI cannot be addressed, but only chip selected by `CS'. My idea was to drive `CS' by Oberon through `GPIO' + interrupt, being a master letting only one party to talk, the other listen, at at time.
Thus having a simple HUB, for some A/D sensors. Alternatively to have also D/D, D/A outputs.
Designing a small control system, so to speak.
Tomas, If you want to experiment with I2C then you can try the I2C controller I wrote for RISC5 a few years ago. It emulates the I2C controller found in many ARM microcontrollers (master-mode only) at register-level. I did not write any software for it, Chris Burrows did and he might share his code with you. See attached verilog file I2C.v (and modified RISC5Top.v which shows you how to add it to the system). Magnus
On Mon, 17 Dec 2018 06:25:18 -0800 Magnus Karlsson <magnus@saanlima.com> wrote:
See attached verilog file I2C.v (and modified RISC5Top.v which shows you how to add it to the system).
Hi Magnus, I2C is mapped to I/O bus address [10..14], I miss what is the physical port on Pepino LX9, to plug these I/O into? I can imagine I have a a pin header connector on Oberon end, and a ribbon cable on device end. -- Tomas Kral <thomas.kral@email.cz>
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Tomas Kral Sent: Wednesday, 19 December 2018 8:05 PM To: oberon@lists.inf.ethz.ch Subject: Re: [Oberon] PO2013 - Real time measurement
On Mon, 17 Dec 2018 06:25:18 -0800 Magnus Karlsson <magnus@saanlima.com> wrote:
See attached verilog file I2C.v (and modified RISC5Top.v which shows you how to add it to the system).
Hi Magnus,
I2C is mapped to I/O bus address [10..14], I miss what is the physical port on Pepino LX9, to plug these I/O into? I can imagine I have a a pin header connector on Oberon end, and a ribbon cable on device end.
You can use any two (one for I2C SCL and one for I2C SDA) of the 16 spare sockets in the 20-way pin header connector (the remaining four are 2 x GND, 3.3v and 5v). Once you have chosen which two to use you need to add the corresponding pin assignments definitions for SDA and SCL to the RISC5_pepino.ucf file. Magnus had these defined as: NET "SDA" LOC = "M10" | PULLUP; NET "SCL" LOC = "T15" | PULLUP; 1. Look at the LX9 pins on the Pepino schematic: "M10" is connected to IO7N "T15" is connected to IO8N 2. Look at the J8 connector on the schematic: IO7N is connected to J8-17 IO8N is connected to J8-19 3. J8 is the 20-way connector on the edge of the board. J8-17 and 19 are labelled as 14 and 15 respectively on the PCB. So SDA of your I2C device connects to 14 and SCL connects to 15 (whew!) Regards, Chris Chris Burrows CFB Software http://www.astrobe.com/RISC5
The one catch is that you need a separate CS (chip select) line for each device you want to connect to a given SPI bus. Only one CS may be active at any time. (Hint: 3-8 decoder/demultiplexer, or even 4-16.) Some microcontroller SPI devices need very careful software design and implementation to make SPI work properly. Motorola/Freescale/NXP is very much in this category. To trigger a data transfer, you must read (and implicitly clear) the SPI Data In buffer register. The implication is that you have to have a way to "snoop" that register, without actually reading and clear it, to get the last data byte in a message, and your driver must KNOW enough about the particular device's data protocol to know when to read and when to snoop. Analog Devices Blackfin SPI devices are a nightmare. (Friends don't let friends do Blackfin SPI. Those words are written in my personal blood, thank you for asking.) -----Original Message----- From: Tomas Kral Sent: Monday, December 17, 2018 3:10 AM To: oberon@lists.inf.ethz.ch Subject: Re: [Oberon] PO2013 - Real time measurement
You can connect as many slaves to the ribbon as you wish, but you can only communicate with a single slave while others are not active.
Wojtek, Thank you, I wanted to achieve a small system bus for Oberon devices, inexpensive, with as few components as possible. I learnt SPI cannot be addressed, but only chip selected by `CS'. My idea was to drive `CS' by Oberon through `GPIO' + interrupt, being a master letting only one party to talk, the other listen, at at time. Thus having a simple HUB, for some A/D sensors. Alternatively to have also D/D, D/A outputs. Designing a small control system, so to speak. -- Tomas Kral <thomas.kral@email.cz> -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Tomas Perhaps this comparison helps: SPI I2C Wires 3 or 4 2 Speed higher slower Power less more Multiple devices own CS per device yes Reception verified no yes Device can lock bus no yes Cost more expensive cheaper how many masters one several noise susceptible more robust Distance short longer Standard variations exist yes Jörg Am 17.12.18, 15:45 schrieb "Oberon im Auftrag von John R. Strohm" <oberon-bounces@lists.inf.ethz.ch im Auftrag von strohm@airmail.net>: The one catch is that you need a separate CS (chip select) line for each device you want to connect to a given SPI bus. Only one CS may be active at any time. (Hint: 3-8 decoder/demultiplexer, or even 4-16.) Some microcontroller SPI devices need very careful software design and implementation to make SPI work properly. Motorola/Freescale/NXP is very much in this category. To trigger a data transfer, you must read (and implicitly clear) the SPI Data In buffer register. The implication is that you have to have a way to "snoop" that register, without actually reading and clear it, to get the last data byte in a message, and your driver must KNOW enough about the particular device's data protocol to know when to read and when to snoop. Analog Devices Blackfin SPI devices are a nightmare. (Friends don't let friends do Blackfin SPI. Those words are written in my personal blood, thank you for asking.) -----Original Message----- From: Tomas Kral Sent: Monday, December 17, 2018 3:10 AM To: oberon@lists.inf.ethz.ch Subject: Re: [Oberon] PO2013 - Real time measurement > You can connect as many slaves to the ribbon as you wish, but you can > only communicate with a single slave while others are not active. Wojtek, Thank you, I wanted to achieve a small system bus for Oberon devices, inexpensive, with as few components as possible. I learnt SPI cannot be addressed, but only chip selected by `CS'. My idea was to drive `CS' by Oberon through `GPIO' + interrupt, being a master letting only one party to talk, the other listen, at at time. Thus having a simple HUB, for some A/D sensors. Alternatively to have also D/D, D/A outputs. Designing a small control system, so to speak. -- Tomas Kral <thomas.kral@email.cz> -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
That’s a good summary. Another way of looking at it is what devices are available for each protocol – that may well decide what you have to use. E.g. we have developed Oberon examples for the following: SPI: SDHC Card 7-Segment LED Newhaven 128 x 32 LCD Display Nokia 132x132 LCD Display AdaFruit 128x160 TFT Display Maxim Real-time Clock (unusual – most are I2C) I2C: MicroChip 8K EEPROM Honeywell Digital Compass TI Digital Temperature Sensor Bosch 3-axis Accelerometer Regards, Chris Burrows CFB Software http://www.astrobe.com From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Jörg Sent: Tuesday, 18 December 2018 1:50 AM To: ETH Oberon and related systems Subject: Re: [Oberon] PO2013 - Real time measurement Tomas Perhaps this comparison helps: SPI I2C Wires 3 or 4 2 Speed higher slower Power less more Multiple devices own CS per device yes Reception verified no yes Device can lock bus no yes Cost more expensive cheaper how many masters one several noise susceptible more robust Distance short longer Standard variations exist yes Jörg Am 17.12.18, 15:45 schrieb "Oberon im Auftrag von John R. Strohm" <oberon-bounces@lists.inf.ethz.ch im Auftrag von strohm@airmail.net <mailto:oberon-bounces@lists.inf.ethz.ch%20im%20Auftrag%20von%20strohm@airmail.net> >: The one catch is that you need a separate CS (chip select) line for each device you want to connect to a given SPI bus. Only one CS may be active at any time. (Hint: 3-8 decoder/demultiplexer, or even 4-16.) Some microcontroller SPI devices need very careful software design and implementation to make SPI work properly. Motorola/Freescale/NXP is very much in this category. To trigger a data transfer, you must read (and implicitly clear) the SPI Data In buffer register. The implication is that you have to have a way to "snoop" that register, without actually reading and clear it, to get the last data byte in a message, and your driver must KNOW enough about the particular device's data protocol to know when to read and when to snoop. Analog Devices Blackfin SPI devices are a nightmare. (Friends don't let friends do Blackfin SPI. Those words are written in my personal blood, thank you for asking.) -----Original Message----- From: Tomas Kral Sent: Monday, December 17, 2018 3:10 AM To: oberon@lists.inf.ethz.ch <mailto:oberon@lists.inf.ethz.ch> Subject: Re: [Oberon] PO2013 - Real time measurement > You can connect as many slaves to the ribbon as you wish, but you can > only communicate with a single slave while others are not active. Wojtek, Thank you, I wanted to achieve a small system bus for Oberon devices, inexpensive, with as few components as possible. I learnt SPI cannot be addressed, but only chip selected by `CS'. My idea was to drive `CS' by Oberon through `GPIO' + interrupt, being a master letting only one party to talk, the other listen, at at time. Thus having a simple HUB, for some A/D sensors. Alternatively to have also D/D, D/A outputs. Designing a small control system, so to speak. -- Tomas Kral <thomas.kral@email.cz <mailto:thomas.kral@email.cz> > -- Oberon@lists.inf.ethz.ch <mailto:Oberon@lists.inf.ethz.ch> mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus -- Oberon@lists.inf.ethz.ch <mailto:Oberon@lists.inf.ethz.ch> mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Chris: 1) Are your examples available for download? 2) Having such components begs a question of system integration. Namely, how to add one of these or several to a firmware System On Chip? What are the interfaces? What are the rules? How to add a software driver or drivers after adding the FW components? The latter mostly means the rules for defining registers and their addresses. Here I can point out the Pong P. Chu's approach from his newest SoC books, where he defined an FPro framework enabling an organized approach to adding firmware components and define their address maps. Another well known example is Wishbone. Comparing the two, FPro is simpler and it likely covers most of the needs. On the other hand, NW/PR design was simply a "top level file" where they interfaced whatever components they had, without a formal set of rules how to add new components. Please correct me if I am wrong. So now you/we have your firmware components which can be used in the custom firmware SoC. Do we have the rules how to assemble such an SoC, using these components? Thank you, Wojtek PS: Perhaps we should change the topic from "Real time measurement" to "PO2013 System On Chip", or "PO2018 System On Chip". ________________________________________ From: Oberon [oberon-bounces@lists.inf.ethz.ch] on behalf of Chris Burrows [chris@cfbsoftware.com] Sent: Tuesday, December 18, 2018 2:43 AM To: 'ETH Oberon and related systems' Subject: Re: [Oberon] PO2013 - Real time measurement That’s a good summary. Another way of looking at it is what devices are available for each protocol – that may well decide what you have to use. E.g. we have developed Oberon examples for the following: SPI: SDHC Card 7-Segment LED Newhaven 128 x 32 LCD Display Nokia 132x132 LCD Display AdaFruit 128x160 TFT Display Maxim Real-time Clock (unusual – most are I2C) I2C: MicroChip 8K EEPROM Honeywell Digital Compass TI Digital Temperature Sensor Bosch 3-axis Accelerometer Regards, Chris Burrows CFB Software http://www.astrobe.com
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Skulski, Wojciech Sent: Wednesday, 19 December 2018 3:01 AM To: ETH Oberon and related systems Subject: Re: [Oberon] PO2013 - Real time measurement
Chris:
1) Are your examples available for download?
The examples have been written for, and are included with, the various distributions of Astrobe for Cortex-M. e.g. the list here: http://www.astrobe.com/M3Examples/ReadMe.htm However, the SPI Real-time Clock example for FPGA RISC5 Oberon can be downloaded from the FPGA RISC5 section of the Astrobe Forum: http://www.astrobe.com/forum/viewforum.php?f=13 I'm planning to upload the I2C temperature sensor example that I tested with the Pepino when Magnus originally wrote the I2C interface a couple of years ago: http://saanlima.com/forum/viewtopic.php?f=14&t=1289 However, I'll have to retest it first as there have been a number of significant changes since then.
2) Having such components begs a question of system integration. Namely, how to add one of these or several to a firmware System On Chip? What are the interfaces? What are the rules? How to add a software driver or drivers after adding the FW components? The latter mostly means the rules for defining registers and their addresses.
The choice is yours - you are only constrained by how much you can configure the available pins to SPI or I2C functions. Some of the Cortex-M boards and Digilent FPGA boards have a set of Arduino-compatible pins. This has been very convenient for testing the TFT display on various boards as the one I have is mounted on an Arduino Shield. The PMOD sockets on the Digilent FPGA boards are also very useful and there are a large variety of PMOD-compatible sensors / devices available. The examples and libraries I supply are intended to be used as components / modules (hardware and software) for prototyping. You can develop and test each part of the system individually. How you eventually integrate them into a system is totally up to you and would depend on how many devices of each type (I2C, SPI, GPIO, ADC etc. etc.) you were using and how many pins you had access to. The FPGA boards are very versatile when it comes to configuring them. Regards, Chris Chris Burrows CFB Software http://www.astrobe.com
I wrote a background task for FPGA Oberon to have a SW-based real time clock. Accuracy is rather good. I set the time manually, had the system run for a day and the time was still correct 😊 Jörg -----Original Message----- From: Oberon <oberon-bounces@lists.inf.ethz.ch> On Behalf Of Chris Burrows Sent: Wednesday, December 19, 2018 2:07 PM To: 'ETH Oberon and related systems' <oberon@lists.inf.ethz.ch> Subject: Re: [Oberon] PO2013 - Real time measurement
-----Original Message-----
From: Oberon [ <mailto:oberon-bounces@lists.inf.ethz.ch> mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of
Skulski, Wojciech
Sent: Wednesday, 19 December 2018 3:01 AM
To: ETH Oberon and related systems
Subject: Re: [Oberon] PO2013 - Real time measurement
Chris:
1) Are your examples available for download?
The examples have been written for, and are included with, the various distributions of Astrobe for Cortex-M. e.g. the list here: <http://www.astrobe.com/M3Examples/ReadMe.htm> http://www.astrobe.com/M3Examples/ReadMe.htm However, the SPI Real-time Clock example for FPGA RISC5 Oberon can be downloaded from the FPGA RISC5 section of the Astrobe Forum: <http://www.astrobe.com/forum/viewforum.php?f=13> http://www.astrobe.com/forum/viewforum.php?f=13 I'm planning to upload the I2C temperature sensor example that I tested with the Pepino when Magnus originally wrote the I2C interface a couple of years ago: <http://saanlima.com/forum/viewtopic.php?f=14&t=1289> http://saanlima.com/forum/viewtopic.php?f=14&t=1289 However, I'll have to retest it first as there have been a number of significant changes since then.
2) Having such components begs a question of system integration.
Namely, how to add one of these or several to a firmware System On
Chip? What are the interfaces? What are the rules? How to add a
software driver or drivers after adding the FW components? The latter
mostly means the rules for defining registers and their addresses.
The choice is yours - you are only constrained by how much you can configure the available pins to SPI or I2C functions. Some of the Cortex-M boards and Digilent FPGA boards have a set of Arduino-compatible pins. This has been very convenient for testing the TFT display on various boards as the one I have is mounted on an Arduino Shield. The PMOD sockets on the Digilent FPGA boards are also very useful and there are a large variety of PMOD-compatible sensors / devices available. The examples and libraries I supply are intended to be used as components / modules (hardware and software) for prototyping. You can develop and test each part of the system individually. How you eventually integrate them into a system is totally up to you and would depend on how many devices of each type (I2C, SPI, GPIO, ADC etc. etc.) you were using and how many pins you had access to. The FPGA boards are very versatile when it comes to configuring them. Regards, Chris Chris Burrows CFB Software <http://www.astrobe.com> http://www.astrobe.com -- <mailto:Oberon@lists.inf.ethz.ch> Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems <https://lists.inf.ethz.ch/mailman/listinfo/oberon> https://lists.inf.ethz.ch/mailman/listinfo/oberon
A software solution is fine for a workstation system where it doesn’t need to be too accurate during long-running tasks and can be reset daily. However, we find the RTC more convenient to use on Workstation Oberon simply because we don’t have to enter the date and time whenever we restart the system – which can be several times a day during OS development. But that was not the main reason behind implementing it. The sort of applications we are targeting are: 1. Unattended embedded systems 2. Accurate real-time dataloggers using HCFiler as a high-capacity file system 3. Running continuously for extended periods e.g. weeks or months. The following features of the Maxim DS3234 Real-time Clock / Calendar device we use make it very suitable for *these* applications: :) 1. Counts Seconds, Minutes,Hours, Day, Date, Month, and Year with Leap Year Compensation Valid Up to 2099 2. Battery backup - time is maintained even when the system is powered-down. 3. ±2 minutes per year accuracy from -40°C to +85°C 4. Accurate time is maintained during long-running software tasks. Regards, Chris Chris Burrows http://www.astrobe.com From: Jörg [mailto:joerg.straube@iaeth.ch] Sent: Thursday, 20 December 2018 3:43 AM To: chris@cfbsoftware.com; 'ETH Oberon and related systems' Subject: RE: [Oberon] PO2013 - Real time measurement I wrote a background task for FPGA Oberon to have a SW-based real time clock. Accuracy is rather good. I set the time manually, had the system run for a day and the time was still correct 😊 Jörg -----Original Message----- From: Oberon <oberon-bounces@lists.inf.ethz.ch <mailto:oberon-bounces@lists.inf.ethz.ch> > On Behalf Of Chris Burrows Sent: Wednesday, December 19, 2018 2:07 PM To: 'ETH Oberon and related systems' <oberon@lists.inf.ethz.ch <mailto:oberon@lists.inf.ethz.ch> > Subject: Re: [Oberon] PO2013 - Real time measurement
-----Original Message-----
From: Oberon [ <mailto:oberon-bounces@lists.inf.ethz.ch> mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of
Skulski, Wojciech
Sent: Wednesday, 19 December 2018 3:01 AM
To: ETH Oberon and related systems
Subject: Re: [Oberon] PO2013 - Real time measurement
Chris:
1) Are your examples available for download?
The examples have been written for, and are included with, the various distributions of Astrobe for Cortex-M. e.g. the list here: <http://www.astrobe.com/M3Examples/ReadMe.htm> http://www.astrobe.com/M3Examples/ReadMe.htm However, the SPI Real-time Clock example for FPGA RISC5 Oberon can be downloaded from the FPGA RISC5 section of the Astrobe Forum: <http://www.astrobe.com/forum/viewforum.php?f=13> http://www.astrobe.com/forum/viewforum.php?f=13 I'm planning to upload the I2C temperature sensor example that I tested with the Pepino when Magnus originally wrote the I2C interface a couple of years ago: <http://saanlima.com/forum/viewtopic.php?f=14&t=1289> http://saanlima.com/forum/viewtopic.php?f=14&t=1289 However, I'll have to retest it first as there have been a number of significant changes since then.
2) Having such components begs a question of system integration.
Namely, how to add one of these or several to a firmware System On
Chip? What are the interfaces? What are the rules? How to add a
software driver or drivers after adding the FW components? The latter
mostly means the rules for defining registers and their addresses.
The choice is yours - you are only constrained by how much you can configure the available pins to SPI or I2C functions. Some of the Cortex-M boards and Digilent FPGA boards have a set of Arduino-compatible pins. This has been very convenient for testing the TFT display on various boards as the one I have is mounted on an Arduino Shield. The PMOD sockets on the Digilent FPGA boards are also very useful and there are a large variety of PMOD-compatible sensors / devices available. The examples and libraries I supply are intended to be used as components / modules (hardware and software) for prototyping. You can develop and test each part of the system individually. How you eventually integrate them into a system is totally up to you and would depend on how many devices of each type (I2C, SPI, GPIO, ADC etc. etc.) you were using and how many pins you had access to. The FPGA boards are very versatile when it comes to configuring them. Regards, Chris Chris Burrows CFB Software <http://www.astrobe.com> http://www.astrobe.com -- <mailto:Oberon@lists.inf.ethz.ch> Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems <https://lists.inf.ethz.ch/mailman/listinfo/oberon> https://lists.inf.ethz.ch/mailman/listinfo/oberon
However, we find the RTC more convenient to use on Workstation Oberon simply because we don’t have to enter the date and time whenever we restart the system – which can be several times a day during OS development. I don’t either. Get it from a time server. My SW solution is as accurate as the 25 MHz FPGA CPU clock is. Jörg
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Chris Burrows Sent: Wednesday, 19 December 2018 11:37 PM To: 'ETH Oberon and related systems' Subject: Re: [Oberon] PO2013 - Real time measurement
I'm planning to upload the I2C temperature sensor example that I tested with the Pepino when Magnus originally wrote the I2C interface a couple of years ago:
http://saanlima.com/forum/viewtopic.php?f=14&t=1289
However, I'll have to retest it first as there have been a number of significant changes since then.
The Embedded Project Oberon I2C example for a Honeywell digital compass which has been tested on the Pepino-LX9 development board can now be downloaded from the Astrobe forum: http://www.astrobe.com/forum/viewforum.php?f=15 Regards, Chris Chris Burrows CFB Software http://www.astrobe.com/RISC5
John:
Analog Devices Blackfin SPI devices are a nightmare. (Friends don't let friends do Blackfin SPI. Those words are written in my personal blood, thank you for asking.)
It is not that bad in my experience. I used Blackfin a lot with very few problems. The trick was to use Analog Devices software, in particular their uCLinux. It used to be very well supported by Robin Getz and his cohort, until Analog Devices management stepped in and made "improvements" to the user community structure. The support immediately went down drain. (Sorry, Robin, it is my sincere experience.) I moved to ARM Sitara because of that. Well, if you think that Blackfin was tough then try Sitara instead. Sitara gives a whole new meaning to the word "nightmare". Back to the topic, we used spidev under Blackfin uCLinux and it solved all our problems at the Blackfin side. The remaining problems were due to the ingenious modification of the SPI interface which Analog Devices made in their ADC chips. Namely, they combined the input and output pins into one IO pin. It saved one pin and created need to invert the pin direction with a command. What a genius has invented this idea. Yes, SPI can be an endless topic over a beer and around a campfire. Wojtek
ARM Sitara because of that. Well, if you think that Blackfin was tough then try Sitara instead. Sitara gives a whole new meaning to the word "nightmare".
It never ceases to amaze me how supposedly-professional hardware designers manage to mess up actual hardware for all its users. I suspected John was talking about the SPI host interface, and my experience is as ugly as all of yours (and you have my sympathy). Even if you look at the Raspberry Pi's Broadcom chip it's a scandal that it's still so badly documented yet fully targeted towards education (though perhaps not actual computer science, more plugging things together with Python scripts it seems - but anyway). It's all a long way from the "ideals" that Prof. Wirth often pointed out hardware designers should follow whenever possible, and not make excuses. So many lost opportunities! The pure joy of designing my own, simple SPI host interface to add to the RISC5 machine was not borne out of some academic perfectionism, but more the maniacal laughter of one who finally had the power to right a few of those wrongs encountered in brutal experience... :) Cheers, Paul
Paul:
It never ceases to amaze me how supposedly-professional hardware designers manage to mess up actual hardware for all its users.
I do not want to complain. Texas Instruments have blessed us all with wonderful devices which we all enjoy. Having said this, let me entertain you with a few numbers. I just downloaded the AM335x Technical Reference Manual Revision P, publication spruh73p.pdf. I often entertain people asking them how many pages the TRM would have if printed. They usually guess "a few hundred perhaps?". Well, the TRM Revision P has 5113 pages. (Five thousand one hundred thirteen.) The list of figures starts on page 13 and ends on page 92. These pages are not figures. They are a *list of* figures, mostly depicting internal registers. The list of tables starts on page 93 and ends on page 172. Again, it is just the list rather than the tables themselves. The actual Introduction starts on page 174. The previous 173 pages are occupied with a Table of content, list of figures, and the list of tables. I wonder how many pages the AM335x TRM Revision Z will have....
Even if you look at the Raspberry Pi's Broadcom chip it's a scandal that it's still so badly documented yet fully targeted towards education (though perhaps not actual computer science, more plugging things together with Python scripts it seems - but anyway).
RPi chip is an ARM of a similar complexity to Sitara. Unlike Sitara, you cannot buy the Broadcom chip on a free market and thus you cannot design your own boards using it. This is why I chose Sitara over RPi. Wojtek
My experience was with the BF535, bare metal, some 12-13 years ago. uCLinux was not an option for what we were doing. -----Original Message----- From: Skulski, Wojciech Sent: Monday, December 17, 2018 10:57 AM To: ETH Oberon and related systems Subject: Re: [Oberon] PO2013 - Real time measurement John:
Analog Devices Blackfin SPI devices are a nightmare. (Friends don't let friends do Blackfin SPI. Those words are written in my personal blood, thank you for asking.)
It is not that bad in my experience. I used Blackfin a lot with very few problems. The trick was to use Analog Devices software, in particular their uCLinux. It used to be very well supported by Robin Getz and his cohort, until Analog Devices management stepped in and made "improvements" to the user community structure. The support immediately went down drain. (Sorry, Robin, it is my sincere experience.) I moved to ARM Sitara because of that. Well, if you think that Blackfin was tough then try Sitara instead. Sitara gives a whole new meaning to the word "nightmare". Back to the topic, we used spidev under Blackfin uCLinux and it solved all our problems at the Blackfin side. The remaining problems were due to the ingenious modification of the SPI interface which Analog Devices made in their ADC chips. Namely, they combined the input and output pins into one IO pin. It saved one pin and created need to invert the pin direction with a command. What a genius has invented this idea. Yes, SPI can be an endless topic over a beer and around a campfire. Wojtek -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
John: BF535 was the first Blackfin. I dare not call it junk, but I believe it can be justifiably named a prototype. It was superseded by the newer Blackfins long ago. I used BF532, BF533, and BF561. Most of my work was with BF561. I really appreciated Analog Devices documentation. Their Technical Reference Manual was fun to read, if this kind of literature can be fun. I designed a board based on this TRM and some reference design examples. It worked. Tuning the memory interface was straightforward. I stumbled across a silicon bug in a Marvell GbE PHY and I was able to fix this bug in the Linux kernel driver in about two weeks, despite the fact that it was my first encounter with the Linux kernel, and one of my first serious encounters with C. All in all, Blackfin BF561 was a a very good chip. My only real problem was that they did not integrate the GbE MAC on any Blackfin chip. So I switched to Sitara to gain performance. If I knew then what I know now, I would probably stay with Blackfin and try solving the data readout challenge in some other way. Wojtek ________________________________________ From: Oberon [oberon-bounces@lists.inf.ethz.ch] on behalf of John R. Strohm [strohm@airmail.net] Sent: Tuesday, December 18, 2018 12:08 AM To: ETH Oberon and related systems Subject: Re: [Oberon] PO2013 - Real time measurement My experience was with the BF535, bare metal, some 12-13 years ago. uCLinux was not an option for what we were doing. -----Original Message----- From: Skulski, Wojciech Sent: Monday, December 17, 2018 10:57 AM To: ETH Oberon and related systems Subject: Re: [Oberon] PO2013 - Real time measurement John:
Analog Devices Blackfin SPI devices are a nightmare. (Friends don't let friends do Blackfin SPI. Those words are written in my personal blood, thank you for asking.)
It is not that bad in my experience. I used Blackfin a lot with very few problems. The trick was to use Analog Devices software, in particular their uCLinux. It used to be very well supported by Robin Getz and his cohort, until Analog Devices management stepped in and made "improvements" to the user community structure. The support immediately went down drain. (Sorry, Robin, it is my sincere experience.) I moved to ARM Sitara because of that. Well, if you think that Blackfin was tough then try Sitara instead. Sitara gives a whole new meaning to the word "nightmare". Back to the topic, we used spidev under Blackfin uCLinux and it solved all our problems at the Blackfin side. The remaining problems were due to the ingenious modification of the SPI interface which Analog Devices made in their ADC chips. Namely, they combined the input and output pins into one IO pin. It saved one pin and created need to invert the pin direction with a command. What a genius has invented this idea. Yes, SPI can be an endless topic over a beer and around a campfire. Wojtek -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.inf.ethz.ch_mailman_listinfo_oberon&d=DwICAg&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=uUiA_zLpwaGJIlq-_BM9w1wVOuyqPwHi3XzJRa-ybV0&m=YHxnBuD8Q84reJtzjulF1A5MG02DEE_T9UqFReCw1YQ&s=b-k1P2ZvK2fTUrFU1AOH-sUwPOoqNv4v2uff-NaNU08&e= --- This email has been checked for viruses by Avast antivirus software. https://urldefense.proofpoint.com/v2/url?u=https-3A__www.avast.com_antivirus&d=DwICAg&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=uUiA_zLpwaGJIlq-_BM9w1wVOuyqPwHi3XzJRa-ybV0&m=YHxnBuD8Q84reJtzjulF1A5MG02DEE_T9UqFReCw1YQ&s=YnBdMsPdWYaxYwuocr4YCoU43b6gHy55sWLxNwU7gqY&e= -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.inf.ethz.ch_mailman_listinfo_oberon&d=DwICAg&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=uUiA_zLpwaGJIlq-_BM9w1wVOuyqPwHi3XzJRa-ybV0&m=YHxnBuD8Q84reJtzjulF1A5MG02DEE_T9UqFReCw1YQ&s=b-k1P2ZvK2fTUrFU1AOH-sUwPOoqNv4v2uff-NaNU08&e=
Hi, Trying to revive an old topic, using PIC to collect data for Oberon System. Reading specs of [1] PIC16F84A [2] PIC16F818 [1] Seems a good starter, but [2] has a lot more features, e.g A/D, also SPI / I2C. Manual gives these signals on SPI Serial Data Out (SDO) RB2/SDO/CCP1 Serial Data In (SDI) RB1/SDI/SDA Serial Clock (SCK) RB4/SCK/SCL Slave Select (SS) RB5/SS And this on I2C I2C Slave mode (7-bit address) I2C Slave mode (10-bit address) I2C Slave mode (7-bit address) with Start and Stop bit interrupts enabled to support Firmware Master mode I2C Slave mode (10-bit address) with Start and Stop bit interrupts enabled to support Firmware Master mode I2C Firmware Controlled Master mode with Start and Stop bit interrupts enabled, slave is Idle I am zero on I2C, but have some little knowledge of SPI, but the signals above are named differently to Oberon RISC5 docs?? I like this picture on SPI chip select addressing. Oberon GPIO is 8 bit, some can be configured to I2C or SPI signals, I hope. This is now long term goal of mine> I want to achieve an interconnection of field instruments with Oberon system through PIC, incl. A/D, D/D, etc conversions. So one could measure temperature, and other physical qualities. And at the same time drive some actions on the controlled process, valves open/close, servos on/off. Ideally with proportional regulation. I wish to start with a simple thermistor temperature probe, A/D conversion, and some trending in Oberon system. -- Tomas Kral <thomas.kral@email.cz>
Tomas What exactly is your intended setup? Do you want to connect a HW probe to the PIC and the PIC to the Oberon system? If this your intended setup it is in my point a little strange as you could connect the HW probe directly to the Oberon system without using the mentioned PIC chip. It obviously depends on the probe you want to connect. You did not mention what probe you want to connect. Try to see the Oberon system as kind of PIC with the benfit of being programmed in Oberon instead of eg C for the PIC. br Jörg
Am 24.03.2019 um 16:13 schrieb Tomas Kral <thomas.kral@email.cz>:
Hi,
Trying to revive an old topic, using PIC to collect data for Oberon System.
Reading specs of [1] PIC16F84A [2] PIC16F818
[1] Seems a good starter, but [2] has a lot more features, e.g A/D, also SPI / I2C.
Manual gives these signals on SPI
Serial Data Out (SDO) RB2/SDO/CCP1 Serial Data In (SDI) RB1/SDI/SDA Serial Clock (SCK) RB4/SCK/SCL Slave Select (SS) RB5/SS
And this on I2C
I2C Slave mode (7-bit address) I2C Slave mode (10-bit address) I2C Slave mode (7-bit address) with Start and Stop bit interrupts enabled to support Firmware Master mode I2C Slave mode (10-bit address) with Start and Stop bit interrupts enabled to support Firmware Master mode I2C Firmware Controlled Master mode with Start and Stop bit interrupts enabled, slave is Idle
I am zero on I2C, but have some little knowledge of SPI, but the signals above are named differently to Oberon RISC5 docs??
I like this picture on SPI chip select addressing.
Oberon GPIO is 8 bit, some can be configured to I2C or SPI signals, I hope.
This is now long term goal of mine> I want to achieve an interconnection of field instruments with Oberon system through PIC, incl. A/D, D/D, etc conversions. So one could measure temperature, and other physical qualities. And at the same time drive some actions on the controlled process, valves open/close, servos on/off. Ideally with proportional regulation.
I wish to start with a simple thermistor temperature probe, A/D conversion, and some trending in Oberon system.
-- Tomas Kral <thomas.kral@email.cz> <SPI_slaves.png> -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Hi Joerg,
you could connect the HW probe directly to the Oberon system without using the mentioned PIC chip.
True, possibly with use of A/D converter, or with a probe outputting /D directly.
Try to see the Oberon system as kind of PIC with the benefit of being programmed in Oberon instead of eg C for the PIC.
Point taken, but after reading `A Microcontroller System for Experimentation' with PIC, I felt equally tempted to do my own experiments with a breadboard. There is one experiment with thermo probe here, https://inf.ethz.ch/personal/wirth/PICL/PIC.pdf Then I found this page on NTC, http://www.giangrandi.ch/electronics/ntc/ntc.shtml, that made me hooked, there is a voltage divider, that needs Vref to feed A/D input. I hope this is the way to connect to PIC. As R(T) is non-linear, some calculation is required, I need to find about yet. I would like to start with `NTC-0,2 6,8K' just for ambient temperatures. I would not know yet, how to choose suitable R25 for other work ranges, as I believe the narrower work range the higher precision, possibly. -- Tomas Kral <thomas.kral@email.cz>
Hi Tomas,
[2] PIC16F818...has a lot more features, e.g A/D, also SPI / I2C.
As I mentioned before, I've been using the PIC16(L)F1455/9 because they have even more features still, for about the same price. But the PIC16F818 seems perfectly good, since it seems to be able to run at 3.3V as well as 5V. For interfacing with the FPGA, you should power it at 3.3V. I notice the PIC16F818 also supports low-voltage programming (LVP), so you should be able to program it using a modified version of Prof. Wirth's PICL directly from the FPGA, without having to buy a special PIC programmer. I've recently programmed the PIC16LF1459 successfully using LVP from Oberon running on an FPGA; the changes were not onerous.
Manual gives these signals on SPI
Serial Data Out (SDO) RB2/SDO/CCP1 Serial Data In (SDI) RB1/SDI/SDA Serial Clock (SCK) RB4/SCK/SCL Slave Select (SS) RB5/SS ... the signals above are named differently to Oberon RISC5 docs??
The PIC documentation names the SPI signals slightly differently because it can be configured as an SPI master or a slave. If it's a slave (which is what you want), then SDI (SPI data in) is connected to the FPGA's MOSI (master out, slave in) and SDO (SPI data out) is connected to the FPGA's MISO (master in, slave out).
I like this picture on SPI chip select addressing.
Oberon GPIO is 8 bit, some can be configured to ... SPI signals, I hope.
Yes. I designed the SPI interface to be very simple and low-level, in contrast to a lot of system-on-chip designs. You can connect any of the Oberon's GPIO to the PIC16F818's SS pin, and use the existing Oberon SPI master interface to operate the SCK, MOSI and MISO lines, without interfering with the SD-Card and network, because their SS pins will stay inactive if you leave the relevant SPI control port bits (port 0FFFD4H, -44, bits 0 and 1) at 0. There's a slight caveat there, in that if you use interrupts, you will have to take care not to interfere with other uses of SPI. There are of course many ways of dealing with this but most will involve changing the hardware. Fortunately, it's an FPGA. ;-) But of course the whole point of using a PIC, apart from adding the analogue interface(s) that simply don't exist on the FPGA, is to offload some of the processing (which is exactly what the PIC was designed for in the first place) so polling may well be fine as a solution.
This is now long term goal of mine> I want to achieve an interconnection of field instruments with Oberon system through PIC, incl. A/D, D/D, etc conversions. So one could measure temperature, and other physical qualities. And at the same time drive some actions on the controlled process, valves open/close, servos on/off. Ideally with proportional regulation.
I wish to start with a simple thermistor temperature probe, A/D conversion, and some trending in Oberon system.
The PIC16LF1459 has a temperature sensor built-in, but if you want to do probing where the environment is unfriendly to a chip then a thermistor probe does indeed make sense. :) You could store the trend data (up to ~128 bytes, less what you need for the program scratch registers) in the PIC's data memory (or in EEPROM) and then you wouldn't even need a background task in Oberon. HTH Paul
Paul wrote:
But of course the whole point of using a PIC, apart from adding the analogue interface(s) that simply don't exist on the FPGA, is to offload some of the processing (which is exactly what the PIC was designed for in the first place) so polling may well be fine as a solution.
Another solution may be adding more RISC5 processors to the same FPGA. Not possible with the original Spartan-3 200, but it is certainly possible with larger FPGAs. The extra CPUs do not need to be full RISC5, actually. They can be modified RISC5's without floating point. Adding one or a few PicoBlaze processors is another option. A multicore design can be fun, I suppose. The communication among the cores was worked out by Professor Wirth in one of his papers available from his web site. A simple case can be handled by a shared register or a shared BRAM, depending on the amount of data to be exchanged. Polling is definitely an option here. Concerning analog interfaces, these can be added with PMOD boards which are available from Digilent. They are simple slave boards interfaced with SPI and/or GPIO. Wojtek
Another solution may be adding more ... processors to the same FPGA
Prof. Wirth designed the TRM processor for this purpose https://inf.ethz.ch/personal/wirth/FPGA-relatedWork/index.html which is used in ETH's Active Cells distributed processing model. But the PIC gives you analog, and a complete offload processor, in a DIL package suitable for breadboarding, programable in a "Wirth" language, for less than a tenth of the price of a PMOD. Cheers, Paul
Hi Paul,
PIC16F818 seems perfectly good, since it seems to be able to run at 3.3V as well as 5V. For interfacing with the FPGA, you should power it at 3.3V.
I found this programmer on the net, that I wish to give a try. Single sided PCB, soldering iron, that seems within reach of my hobby capabilities. Later as my knowledge and confidence grows, I may try programming through FPGA and PICL directly. What I need to find out yet, how to best match the PIC to FPGA frequency. PIC has got its own xtal, and may support also low cost RC resonator.
But of course the whole point of using a PIC, apart from adding the analogue interface(s) that simply don't exist on the FPGA, is to offload some of the processing
I was also thinking to use PIC as a single loop PID controller, Oberon then as a sort of supervision and visual layer for trends and some optimisations. Not sure though, we could do PID without FPU math, just using integers? -- Tomas Kral <thomas.kral@email.cz>
I found this programmer on the net, that I wish to give a try. Single sided PCB, soldering iron, that seems within reach of my hobby capabilities. Later as my knowledge and confidence grows, I may try programming through FPGA and PICL directly.
Seems like a lot of work when you have the FPGA solution already in PICL.Mod. Compare the code to the programming commands in http://ww1.microchip.com/downloads/en/DeviceDoc/39603c.pdf. Also, you probably don't want that programmer circuit, I think it's designed to run off the old +-12V RS232 voltages. Old PIC programmers like that don't tend to work nowadays, since even if you have a USB to RS232 converter or an old laptop serial port, it probably won't generate the full voltage swings. Google further if you don't believe me. :) If the purpose of the exercise is to learn, I think building an analogue PIC programmer (with the high voltage programming pin) is a bit of a side-track.
What I need to find out yet, how to best match the PIC to FPGA frequency. PIC has got its own xtal, and may support also low cost RC resonator.
The PIC would run independently of the FPGA on its own oscillator, communicating by providing data on the SPI port when requested (ie as a slave). That *is* a good use of interrupts (in the PIC).
I was also thinking to use PIC as a single loop PID controller, Oberon then as a sort of supervision and visual layer for trends and some optimisations. Not sure though, we could do PID without FPU math, just using integers?
Interesting. Googling, some PIC chips have a PID controller in hardware, it seems: http://ww1.microchip.com/downloads/en/AppNotes/90003136A.pdf That note concludes that using the PIC16F161X's Proportional Integral Derivative (PID) peripheral takes 9 instruction cycles, whereas a software implementation would take about 1000. I agree it might be a stretch to do full PID on an 8-bit PIC in software, but you never know - maybe fixed point in two bytes. I know people who are a lot more experienced with PID than me, so I'll stop speculating now. :) Cheers, Paul
On Mon, 25 Mar 2019 18:38:47 +0000 Paul Reed <paulreed@paddedcell.com> wrote:
I think it's designed to run off the old +-12V RS232 voltages.
It is, I meant for my legacy PC with a real RS232 serial port, I have it almost ready, the PCB I have got also supports in-circuit serial programming through an adapter, that could also link to FPGA, possibly.
The PIC would run independently of the FPGA on its own oscillator, communicating by providing data on the SPI port when requested (ie as a slave).
It is embarrassing, as I do not understand, how it is synced when both SPI ends may run at different speeds. PIC16F818A runs at 8MHz, if I am correct. -- Tomas Kral <thomas.kral@email.cz>
the PCB I have got also supports in-circuit serial programming through an adapter, that could also link to FPGA, possibly.
Certainly not the circuit you attached in your mail. Take great care - I really wouldn't advise this kind of thing. The FPGA will not play well with anything more than 3.3v levels. I know. :( Since the PIC has such a wide operating voltage range, it is ideal for attaching to the FPGA without level conversion, sharing the same supply voltage. People who mess with Raspberry Pis and Arduinos usually find out the difference between 5V logic and 3.3V logic the hard way. Adding a traditional PIC programmer into the mix, with its 12-14V programming voltage on the same pin (MCLR) as has often a pullup resistor to Vdd (5V or 3.3V) is definitely asking for trouble. Just saying...
...how it is synced when both SPI ends may run at different speeds. PIC16F818A runs at 8MHz, if I am correct.
I think you can run it up to 20MHz with an external oscillator but the datasheet isn't very clear to me on a first reading. Anyway, the RISC processor and the PIC certainly wouldn't run synchronously in lock-step, instruction by instruction; they would run independently, communicating asynchronously, with SPI, for example, replacing the ad-hoc serial data link described in Prof. Wirth's "A Microcontroller System for Experimentation". Cheers, Paul
On Mon, 25 Mar 2019 21:23:01 +0000 Paul Reed <paulreed@paddedcell.com> wrote:
Certainly not the circuit you attached in your mail.
True, I picked the other picture. I am now scratching my head over High vs Low voltage PIC programming (default on newer PICs), reading info in the specs and on net. Looking at a simplified PIC prog by NW, it feeds signals from std PC parallel port at 0..5V. Exception `MCLR' pin, which is driven 0/5/12V, not sure this is also applicable to newer PICs. Also not clear how to make 12V out of 5V. Low voltage may support programming in VDD operating range i.e. 2.0 to 5.5V (PIC16F8x), and requires `RB3' be pulled down by a resistor to GND. So one more wire in addition to High voltage mode. Exception seems `MCLR' to do bulk erase, VDD of 4.5V to 5.5V is required! I can now see your point, that with a slight modification of NW original code for PC parallel port, PIC can now be programmed through FPGA GPIO at 3.5V signal levels. Being rather H/W numb, cannot figure out recommended wiring, I found this on the net, with 5V to be 3.5V for FPGA, which may be close? Then `ICSP' (in-circuit-ser-prog), possibly also requires a suitable connector+plug, to isolate prog mode to normal operation mode. At the expense of `RB3' that has a dedicated function. -- Tomas Kral <thomas.kral@email.cz>
Thomas: A few remarks. The LVTTL voltage is 3.3V, not 3.5V. FPGAs have "banks" of IO pins which you can power with Vcco ranging from 1.2V to 3.3V. The Vcco is defining the maximum output voltage delivered by a given bank. If Vcc0o=2.5 V (for example) then the bank can drive 2.5V and no more. Spartan-6 FPGAs can take up to 4.1V on any input pin regardless of Vcco. It is a peculiarity of this FPGA family and I would not take it as a rule. A typical LVTTL chip may get damaged, so better do not memorize this number. It is good to know as a curiosity and never be relied upon. It is not voltage but rather current what damages the I/O pins. If you do not want to study this subject in depth, then insert series resistors everywhere. Use 1k series resistor on every I/O pin. It will limit the current to at most a few mA, which is below the 10 mA absolute maximum rating. The resistor will decrease the edge speed. Use low frequency clock and you should be fine. Do not exceed a MHz or so if you do not want to perform a detailed analysis. Chances are it will work. There is much more to say on the subject of voltage compliance, but the preceding may be sufficient, so let's stop here. Concerning twelve volts, your best bet is probably a battery if you do not plan to build your own circuits. Be careful with the wires because any battery can easily output a few amps in a burst, and this will really damage any FPGA if you do not limit the current with an appropriate resistor. Hope it helps. Wojtek ________________________________________ From: Oberon [oberon-bounces@lists.inf.ethz.ch] on behalf of Tomas Kral [thomas.kral@email.cz] Sent: Thursday, March 28, 2019 6:38 AM To: oberon@lists.inf.ethz.ch Subject: Re: [Oberon] PO2013 - Real time measurement On Mon, 25 Mar 2019 21:23:01 +0000 Paul Reed <paulreed@paddedcell.com> wrote:
Certainly not the circuit you attached in your mail.
True, I picked the other picture. I am now scratching my head over High vs Low voltage PIC programming (default on newer PICs), reading info in the specs and on net. Looking at a simplified PIC prog by NW, it feeds signals from std PC parallel port at 0..5V. Exception `MCLR' pin, which is driven 0/5/12V, not sure this is also applicable to newer PICs. Also not clear how to make 12V out of 5V. Low voltage may support programming in VDD operating range i.e. 2.0 to 5.5V (PIC16F8x), and requires `RB3' be pulled down by a resistor to GND. So one more wire in addition to High voltage mode. Exception seems `MCLR' to do bulk erase, VDD of 4.5V to 5.5V is required! I can now see your point, that with a slight modification of NW original code for PC parallel port, PIC can now be programmed through FPGA GPIO at 3.5V signal levels. Being rather H/W numb, cannot figure out recommended wiring, I found this on the net, with 5V to be 3.5V for FPGA, which may be close? Then `ICSP' (in-circuit-ser-prog), possibly also requires a suitable connector+plug, to isolate prog mode to normal operation mode. At the expense of `RB3' that has a dedicated function. -- Tomas Kral <thomas.kral@email.cz>
Only to add knowledge to non FPGA users, a couple of additional solutions for low speed ADC are : 1/ Use the internal ADC block available in some newest FPGAs https://www.xilinx.com/support/documentation/product-briefs/artix7-product-b... "As part of the 7 series, Artix-7 FPGAs also offer other system integration capabilities such as integrated, advanced Analog Mixed Signal (AMS) technology. Whether implementing a simple analog-to-digital converter or replacing more costly system-on-a-chip (SoC) functions, analog is the next level of integration that is efficiently accomplished with the independent dual 12-bit, 1MSPS, 17-channel analog-to-digital converters in Artix-7 FPGAs." 2/ If the FPGA do not have an ADC block implement the ADC within the logic farm. http://waltergallegos.com/pdf/AmDC16-Esp.pdf ( in Spanish ) Saludos, Walter
Hi Tomas,
Looking at a simplified PIC prog by NW, it feeds signals from std PC parallel port at 0..5V.
I assume Prof. Wirth originally used a PC-based Oberon system to do PIC programming, but the PICL.Mod on his home page in the section "PICL: A Programming Language for the Microcontroller PIC" assumes the PIC is connected to the FPGA. He added the RISC5's general-purpose I/O port with this in mind, I think. I am not sure how he did the level conversion between 3.3V of the FPGA and 5V. I am suggesting powering the PIC with 3.3V to avoid this problem. Anyway, in https://inf.ethz.ch/personal/wirth/PICL/Sources/PICL.Mod.txt, procedure Reset(), he sets all gpio output registers to 0, and then sets the GPIO control bits 0 and 1 to set these pins to output. In procedure bits(), he sends serial data to the PIC, least significant bit first, by setting the data bit value on GPIO bit 0 (connected to PIC RB7), and then toggling the clock on bit 1 (connected to PIC RB6). Wirth's PICL.Mod code does not control the programming voltage on the MCLR pin of the PIC - I assume he did this with a manual switch. But you could use GPIO bits 2 and 3 (setting them also to output) to control MCLR and RB3 on the PIC16F81x and set these according to the low-voltage programming entry sequence in section 2.4.1 on page 5 of the PIC16F818/819 Flash Memory Programming Specification: http://ww1.microchip.com/downloads/en/DeviceDoc/39603c.pdf This would also mean that you could reset the PIC from the FPGA, by toggling MCLR low. You should still include a pull-up resistor on MCLR, and a pull-down resistor on RB3, so that these pins don't float when the FPGA GPIO pins are set to input (or switched off). The decoupling capacitor between Vdd and ground is always a good idea too. You could also output a toggling value on another pin, say GPIO bit 4, and wire it to PIC RA7 (CLKI) to provide a clock to the PIC, for experimentation and testing - but a free-running clock is much better provided by a crystal and some capacitors (as shown in your diagram) or a 3.3V crystal oscillator (the output of which is simply wired to CLKI). Or if you want to be really cheap you can use the internal RC oscillator (not very accurate). You will have to understand how to program the configuration bits of the PIC in order to select the appropriate oscillator (and do other things like disable the watchdog timer, if you don't want to use it).
Exception `MCLR' pin, which is driven 0/5/12V, not sure this is also applicable to newer PICs. Also not clear how to make 12V out of 5V.
The PIC programmers based on the old RS232 ports were able to do this because 0 and 1 were represented by about -12V and 12V, respectively (actually, anywhere between -3V and -25V, and anywhere between 3V and 25V). Scary. But they were able to regulate to the required voltages using voltage regulators or Zener diodes. I totally don't recommend doing this. Just to be clear. :)
Low voltage may support programming in VDD operating range i.e. 2.0 to 5.5V (PIC16F8x), and requires `RB3' be pulled down by a resistor to GND. So one more wire in addition to [MCLR]
Right.
Exception seems `MCLR' to do bulk erase, VDD of 4.5V to 5.5V is required!
Actually it says that the three bulk erase commands need the whole chip to be powered at 4.5V-5.5V. But you only need these if you use the code protection features. (And by the way Wirth's code has some occasional strange sequences which are also related to code protection). I would avoid code protection, but you could always build a special 5V programmer using a PIC, and then take the PIC out of the circuit and program it using your FPGA at 3.3V. Unless you want it code-protected. ;-) HTH Paul
Hi, Reading docs, having PIC programmer hopefully ready, testing breadboard on hold. SOS, in need of `PIC16F818.INC' and `PIC16F818.H', header files, anywhere to be got, trying to avoid installing `MPLAB', that keeps them on all pics. Many thanks in advance. -- Tomas Kral <thomas.kral@email.cz>
Sorry, or just https://sourceforge.net/p/gputils/code/HEAD/tree/trunk/gputils/header/p16f81... On 2019-04-11 09:29, Paul Reed wrote:
SOS, in need of `PIC16F818.INC' and `PIC16F818.H', header files,
pi@raspberry:~ $ sudo apt-get install gputils ... Y ... pi@raspberry:~ $ less /usr/share/gputils/header/p16f818.inc
HTH Paul -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
On Thu, 11 Apr 2019 09:29:50 +0100 Paul Reed <paulreed@paddedcell.com> wrote:
pi@raspberry:~ $ sudo apt-get install gputils
Thank you, offtopic slightly, just toying with `gpasm'. Init bcf STATUS, RP0 ;bank0, default on poweron??? bcf STATUS, RP1 clrf PORTA ;all of porta low clrf PORTB ;all of portb low bsf STATUS, RP0 ;change to bank1 Message [302] Register in operand not in bank 0. Ensure bank bits are correct. clrf TRISA ;all of porta outputs Message [302] Register in operand not in bank 0. Ensure bank bits are correct. clrf TRISB ;all of portb outputs bcf STATUS, RP0 ;back to bank0 return While this shuts above messages off `gpasm -w1 my.asm', just wonder, am I really in the wrong bank? -- Tomas Kral <thomas.kral@email.cz>
Thank you, offtopic slightly, just toying with `gpasm'.
Worry not, I'll bring it back by using Oberon: :) (My.Picl) MODULE My; BEGIN !~S.5; !~S.6; A := 0; B := 0; !S.5; A := 0; B := 0; !~S.5 END My. Edit.Open Tomas.Picl (select MODULE) PICL.Compile @ PICL.Decode (Log output PICL.Compile @) PICL 8.8.2014 PIC compiling My 8 (Log output PICL.Decode) 0 00001283 BCF 5 3 1 00001303 BCF 6 3 2 00000185 CLRF 1 5 3 00000186 CLRF 1 6 4 00001683 BSF 5 3 5 00000185 CLRF 1 5 6 00000186 CLRF 1 6 7 00001283 BCF 5 3 So translating that into gpasm I get no errors if I tell the assembler we are in bank 0 on entry (confirmed in the datasheet section 2.2.2, table 2.1): include "p16f818.inc" banksel 0 Init bcf STATUS, RP0 ;bank0, default on poweron??? bcf STATUS, RP1 clrf PORTA ;all of porta low clrf PORTB ;all of portb low bsf STATUS, RP0 ;change to bank1 clrf TRISA ;all of porta outputs clrf TRISB ;all of portb outputs bcf STATUS, RP0 ;back to bank0 end and use the correct processor on the command line: $ gpasm -p pic16f818 my.asm $ HTH Paul
On Thu, 11 Apr 2019 11:39:00 +0100 Paul Reed <paulreed@paddedcell.com> wrote:
(My.Picl) MODULE My;
BEGIN !~S.5; !~S.6; A := 0; B := 0; !S.5; A := 0; B := 0; !~S.5 END My.
Very code efficient, quite shorter to pic asm! S -> status A -> port A B -> port B Meanwhile I tried `picprog' I have built `JDM' programmer for. I know I was warned. Burning pic with this hex file I got.., correct pic id is autodetected. Using >1 µs delays. --rdtsc may work for faster timings. /dev/ttyS1: id 0x04c5: detected pic16f818 version 0x05 Device pic16f818, program memory: 1024, data memory: 128. Erased and removed code protection. Burning program memory, 39 locations, burning data memory, 0 locations, burning id words, 0 locations, burning fuses, 1 location, done. :020000040000FA :100000000B20A001200886001F20A00A1030200627 :10001000031D0228012885018601831685018601BA :1000200083120800FA300000FF3E031D1428080068 :10003000A100F83014201C28A10B19280800FA3060 :0E0040001820FA301820FA301820FA3018284C :02400E00723FFF :00000001FF Reading the same pic I got.. :08000000200B01A008200086201F0AA0301006202F :080008001D032802280101850186168301850186CA :080010001283000830FA00003EFF1D032814000880 :0800180000A130F82014281C0BA12819000830FA80 :07002000201830FA201830FA201830FA281873 :012007003F7227 :00000001FF I can almost see some nibbles are in there, but in wrong places. While address locations differ. `picprog' does not complain on verify pass, though. -- Tomas Kral <thomas.kral@email.cz>
Reading the same pic I got..
:08000000200B01A008200086201F0AA0301006202F ...
Why in this second hex file are your byte counts 08H not 10H? Note that the PIC program words are 14 bits, so padded up to 16 bits there are 8 words per line, not 8 bytes. Still trying to get back on-topic, :) and in case it helps, below is my add-on routine to PICL.Mod to write hex files, including writing up to two config words as needed with my PIC16LF145x. A simple example of usage, from an already-compiled PICL module, and where the config is all-ones, would be PICL.StoreHex -1 Test.hex Cheers, Paul PROCEDURE StoreHex*; VAR i, u, v, sum, conf: INTEGER; T: Texts.Text; S: Texts.Scanner; PROCEDURE nib(n: INTEGER); BEGIN n := n MOD 10H; IF n > 9 THEN INC(n, ORD("A")-ORD("9")-1) END; Texts.Write(W, CHR(n + ORD("0"))) END nib; PROCEDURE byt(n: INTEGER; VAR sum: INTEGER); BEGIN nib(n DIV 10H); nib(n); sum := sum + n END byt; BEGIN conf := -1; Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos); Texts.Scan(S); IF S.class = Texts.Int THEN conf := S.i; Texts.Scan(S) END; IF S.class = Texts.Name THEN Texts.WriteString(W, "PICL.StoreHex"); Texts.WriteHex(W, conf); Texts.Write(W, " "); Texts.WriteString(W, S.s); Texts.Append(Oberon.Log, W.buf); Texts.WriteString(W, ":020000040000FA"); Texts.WriteLn(W); FOR i := 0 TO pc-1 BY 8 DO Texts.Write(W, ":"); sum := 0; u := pc-i; IF u > 8 THEN u := 8 END; byt(u*2, sum); (*nofbytes*) byt(i DIV 80H, sum); byt(i * 2, sum); (*byte address, big-endian*) byt(0, sum); (*record type - data*) FOR v := 0 TO u-1 DO byt(code[i+v], sum); byt(code[i+v] DIV 100H, sum) END; byt(-sum, sum); ASSERT(sum MOD 100H = 0); Texts.WriteLn(W) END ; IF conf # -1 THEN FOR i := 0 TO 2 DO (*config words: adr, conf1, conf2*) Texts.Write(W, ":"); sum := 0; byt(2, sum); (*nofbytes*) IF i = 0 THEN u := 0 ELSE u := 6+i END; byt(u DIV 80H, sum); byt(u*2, sum); (*byte address, big-endian*) IF i = 0 THEN byt(4, sum); (*record type - extended address*) byt(0, sum); byt(1, sum) ELSE byt(0, sum); (*record type - data*) IF i = 1 THEN u := conf DIV 10000H ELSE u := conf END; byt(u MOD 100H, sum); byt(u DIV 100H MOD 100H, sum) END; byt(-sum, sum); ASSERT(sum MOD 100H = 0); Texts.WriteLn(W) END END; Texts.WriteString(W, ":00000001FF"); Texts.WriteLn(W); NEW(T); Texts.Open(T, ""); Texts.Append(T, W.buf); Texts.Close(T, S.s); Texts.WriteInt(W, T.len, 5); Texts.WriteString(W, " done."); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf) END END StoreHex;
On Thu, 11 Apr 2019 21:26:57 +0100 Paul Reed <paulreed@paddedcell.com> wrote:
Why in this second hex file are your byte counts 08H not 10H?
You are right, I used wrong format specifier, when reading the PIC. That is because, I need to study HEX format structure yet. HEX8 did it, apparently there are also HEX16, and HEX32. $ picprog --ihx8 --skip-ones -o out.hex -p /dev/ttyS1 $ cat out.hex :100000000B20A001200886001F20A00A1030200627 :10001000031D0228012885018601831685018601BA :1000200083120800FA300000FF3E031D1428080068 :10003000A100F83014201C28A10B19280800FA3060 :0E0040001820FA301820FA301820FA3018284C :02400E00F33F7E :00000001FF Possibly ready for PICL now. -- Tomas Kral <thomas.kral@email.cz>
Possibly ready for PICL now.
Below is my PICL attempt at your program, if I understood it correctly from your hex, I hope it helps. Note that I added the dummy variables simply so that I could use Prof. Wirth's version of the compiler unchanged. You may want to alter PICL.Mod so that dc is initialised to 20H instead of 12 in PROCEDURE PICL.Compile, then remove my extra variables; although it can be handy as it is, saving adding new pre-defined symbols to the compiler if you want to access those registers (or corresponding ones in other banks). I have a version of the compiler which allows me to optionally declare the address of a variable because I have used several PICs. It's interesting that the PIC16F818 is right in the middle between the simplicity of the PIC16C84/PIC16F84A, and the complexity of the PIC16LF145x which has 32 banks. I made a few other experimental changes to the compiler to accommodate that - not happy with them yet though. Cheers, Paul MODULE My; {define PIC16F818 regs not in PIC16C84 (as a kludge) to move variables to general-purpose RAM, which has changed from address 0CH to 20H in PIC16F818} INT PIR1, PIR2, TMR1L, TMR1H, T1CON, TMR2, T2CON, SSPBUF, SSPCON, CCPR1L,CCPR1H, CCP1CON; INT reg18, reg19, reg1A, reg1B, reg1C, reg1D, ADRESH, ADCON0; {now our variables} INT count; PROCEDURE SetupPorts; BEGIN A := 0; B := 0; {all low} !S.5; A := 0; B := 0; !~S.5 {TRISA, TRISB - all output} END SetupPorts; PROCEDURE DelayLoop(INT n); {~5n cycles} BEGIN REPEAT INC n; DEC n; DEC n UNTIL n = 0 END DelayLoop; PROCEDURE DelayMs(INT n); BEGIN WHILE n # 0 DO DelayLoop(248); DEC n END END DelayMs; PROCEDURE Delay1Sec; BEGIN DelayMs(250); DelayMs(250); DelayMs(250); DelayMs(250) END Delay1Sec; BEGIN SetupPorts; REPEAT count := 0; REPEAT B := count; Delay1Sec; INC count UNTIL count.4 END END My. Edit.Open My.Picl PICL.Compile @ PICL.Decode
On Fri, 12 Apr 2019 15:41:14 +0100 Paul Reed <paulreed@paddedcell.com> wrote:
Below is my PICL attempt at your program, if I understood it correctly from your hex,
Precisely, it is meant 4x250ms delay loop counter, stepping by 1sec up to 16 (UNTIL count.4). Provided PIC@4MHz. Need to study timers, perhaps using them, would be more appropriate in lieu of delays.
I hope it helps.
It does, good learning exercise, as PICL express the algo very neatly. -- Tomas Kral <thomas.kral@email.cz>
On Sat, 13 Apr 2019 11:39:11 +0200 Tomas Kral <thomas.kral@email.cz> wrote:
Precisely, it is meant 4x250ms delay loop counter, stepping by 1sec up to 16 (UNTIL count.4). Provided PIC@4MHz.
Here is my `DIY toy board', `RC' to the right of PIC is a dummy, as `p16f818' has its own internal osc block (unlike `p16f84a' that needs ext. RC or XTAL), so are two switches, need to think how to read an input. I wonder if I could wire switches direct or some pull/ups/downs are recommended? -- Tomas Kral <thomas.kral@email.cz>
Here is my `DIY toy board', `RC' to the right of PIC is a dummy, as `p16f818' has its own internal osc block (unlike `p16f84a' that needs ext. RC or XTAL), so are two switches, need to think how to read an input.
Neat! [sunglasses emoji] ;-) (In your configuration in the hex you published, I thought you *were* using the external RC.)
I wonder if I could wire switches direct or some pull/ups/downs...
You can enable weak pull-ups on PORTB in software, see the datasheet [1] sec. 5.2. I assume you still have the LEDs on bits 3..0, it looks like that may be the case from the picture, I assume you are doing some sneaky wiring underneath the board. ;-) (Curious about the resistor already on RA4, BTW.) So you could wire the pushbuttons across to pins 13 and 12 (RB7..RB6), which wouldn't interfere with the SPI port or with in-circuit programming, assuming you would wire the other side of each pushbutton to ground. You may want external components though, depending on your exact intended de-bounce method. In PICL, the statement ?~B.7 will loop until (the first time) bit 7 of PORTB goes low. See section 5 of [2]. Cheers, Paul [1] PIC16F818/819 datasheet http://ww1.microchip.com/downloads/en/DeviceDoc/39598F.pdf [2] Wirth: "PICL: A Programming Language for the Microcontroller PIC". https://people.inf.ethz.ch/wirth/PICL/PICL.pdf
On Fri, 19 Apr 2019 16:51:25 +0100 Paul Reed <paulreed@paddedcell.com> wrote: Thank you for taking your interest.
(In your configuration in the hex you published, I thought you *were* using the external RC.)
Yes, initially, meant for backward compatibility with `p16f84a'. But I managed to get a couple of `p16f818' for half the price. I wish to connect a thermo sensor, to one of A/D muxed inputs, and drive `PWM' out through that `RC' to have defacto analog out. I have also thought of servos being `PWM' capable, so to get proportional control on a valve seems now possible, or even a robotic arm? My goal is to do a single `PID' control loop, whith a simple `SPI' data exchange (setting P-I-D, while polling A/D measurements). That may require an interrupt (possibly another use of SS signal) to step out of PID loop, do SPI, and return back to the control loop.
I assume you still have the LEDs on bits 3..0, it looks like that may (Curious about the resistor already on RA4, BTW.)
Yes {RB0..RB3}, the resistor is 10K pullup on MCLR to VDD, perhaps not needed, as I get also some reset delay on power up timer. But I have seen this resistor in many wiring diagrams, though, possibly to drive SW reset or in circuit programming? I have found a PID algo on a Microchip site, doing PID in 78-90us. It is based on TMR1/IRQ 1ms timing, so perhaps external interrupt on SS not necessary. -- Tomas Kral <thomas.kral@email.cz>
participants (9)
-
Chris Burrows -
John R. Strohm -
Jörg -
Jörg Straube -
Magnus Karlsson -
Paul Reed -
Skulski, Wojciech -
Tomas Kral -
Walter Gallegos