Is it possible to use USB on pic18f4550 without an external crystal? I'm trying to run "HID Read Write Interrupt" example (from mikroC) but I don't have an oscillator (I have tic 3.579545mf which seems to be of no help). How can I configure my microcontroller to use internal oscillator for USB? The datasheet is too complicated for me now, I can't even understand if it's possible at all.
I also have pic12f683, can I use it instead of the crystal?
Unfortunately, no, it is not possible to use USB on PIC18F4550 without an external crystal. Other PICs in the 18F family provide this capability. But the PIC18F4550 datasheet section 2.2.5.1 Internal Oscillator Modes states “When the internal oscillator is used as the microcontroller clock source, one of the other oscillator modes (External Clock or External Crystal/Resonator) must be used as the USB clock source.”
And I don't see an easy way to use the PIC12F683 as the external oscillator source. It has an 8 MHz internal oscillator (HFINTOSC) that can be configured to output FOSC/4 output on the OSC2 pin, which is 2 MHz. But going back to the PIC18F4550 datasheet TABLE 2-3: OSCILLATOR CONFIGURATION OPTIONS FOR USB OPERATION the lowest Input Oscillator Frequency is 4 MHz.
Try this device, which has an internal 48Mhz oscillator for direct configuration and support of USB2.0 fullspeed :
PIC16F1459
Related
I'm a beginner in the embedded system development world.
I would like some clarifications on the following questions.
Is every pin of a microcontroller (from here after referred to as mc) associated with a register?
Is it an one to one relationship?
How are ports (or groups of pins) assigned inside the mc?
Is it only possible to set a single pin low or high only?
No. Some pins are not associated with a register at all, e.g. Vcc and GND and if they do not have a dual use as a GPIO it also applies to clock/oscillator and reset pins.
If a pin is associated with registers, it is usually associated with several ones: one for determing the IO direction, one for reading the input, one or more for setting the output. For I2C, SPI, UART pins, the associated is indirect, i.e. the register mainly control the I2C/SPI/UART controller, which in turn is associated with the pin.
I don't understand the question
A GPIO pin can be set as input, as output in high state (delivering current or with a weak pull-up), as output in low state (sourcing current or with a weak pull-down) or in open-drain state (often similar to input mode). A pin can also be configured to be used by one fo the I2C/SPI/UART controllers or as DAC (outputting a variable voltage between GND and Vcc).
In addition to fundamental stuff like supply and clock pins, a MCU got numerous hardware peripherals internally. A hardware peripheral being something like a piece of GPIO (general-purpose input/output), ADC, UART, SPI etc. Each such hardware peripheral has a number of possible pins to which its functions can be routed.
Traditionally, these were pretty much fixed - if you wanted UART Tx then you would always get it on some fixed pin number, take it or leave it. Nowadays, most MCUs are quite flexible internally, allowing you to re-route hardware peripheral functionality to almost any pin you like, variably.
In either case, several hardware peripherals could share the same pin, and then it is MCU specific which one that takes precedence. For example GPIO could be present on the pin by default, but if you enable UART then maybe the MCU states that you get UART Tx on that pin instead.
As for the hardware peripheral called GPIO, they are almost always grouped in ports, where each port consists of a number of pins. Most often, port registers are either 8 bits or the size of the CPU's word length. Each bit in the various port registers corresponds to a pin.
You'll have a port data register, which is the actual read/write to the pin, a data direction register stating input or output, and then various other registers for interrupts, pull resistor enable etc etc.
Not all pins but all IOs (Input/Output) have a specific register.
Each IO has a specific group of registers. Bu also some registers may include specific bits which effects an IO or all IOs.
It depends of design of micro controller.
Yes it is.
I strongly recommend you to read some embedded hardware/software books(for example Newness Know It All books for embedded systems) and datasheets.
I'm using the SparkFun nRF52832 Breakout to use the RTC signal for a sensor pressure clock line.
Unfortunately, on the two RTC pins, there are no signals. To verify this point, I used an oscilloscope to read pins 0 and 1.
Besides, I also created a sketch on another pin to generate my own square signal close to 33.333kHz, and I saw it on the oscilloscope.
I understand according to this tutorial that I do not need to modify the hardware.
RTC-EN - Connect/Disconnect the 32.768kHz Crystal
The nRF52832 Breakout equips the chip with a 32.768kHz crystal – connected to GPIO pins 0 and 1. Unfortunately, those pins make up a quarter > of the available ADC inputs. So, if your application doesn’t require an RTC – and you need those pins to for another purpose – grab a hobby knife and cut the two traces between their pads to disconnect the crystal.
Maybe I need to init the RTC pin with a dedicated method, but which one?
Could you provide me a link to any tutorial?
Any ideas what I'm missing here? What is my misunderstanding?
In the reference manual for the ZYBO board that I am using, it informs me that I have up to four clocks I can use. However, when I look through the UCF file, I can only find one of them.
Considering that the ISE tools might know where it is, I used the Timing Analyzer to try to get the system to generate a pin LOC that I could use, this was a fialure though.
Then I had the idea to use the PlanAhead tools to try and see if the tools would again generate a UCF file with the needed clock pin locations. Again this failed.
Have I misunderstood the manual? Is there only one clock pin available to me?
Here is the excerpt in question (12 Clock Sources):
The ZYBO provides
a 50 MHz clock to the Zynq PS_CLK input, which is used to generate the
clocks for each of the PS subsystems. The 50 MHz input allows the
processor to operate at a maximum frequency of 650 MHz and the DDR3
memory controller to operate at a maximum of 525 MHz (1050 Mbps). The
ZYBO Base System Design configures the PS to work properly with this
input clock, and should be used as a reference when creating custom
designs.
The PS has a dedicated PLL capable of generating up to four reference
clocks, each with settable frequencies, that can be used to clock
custom logic implemented in the PL. Additionally, The ZYBO provides an
external 125 MHz reference clock directly to pin L16 of the PL. The
external reference clock allows the PL to be used completely in
dependently of the PS, which can be useful for simple applications
that do not require the processor.
The PL of the Zynq-Z7010 also includes two MMCM’s and two PLL’s that
can be used to generate clocks with precise frequencies and phase
relationships. Any of the four PS reference clocks or the 125 MHz
external reference clock can be used as an input to the MMCMs and
PLLs. For a full description of the capabilities of the Zynq PL
clocking resources, refer to the “7 Series FPGAs Clocking Resources
User Guide” available from Xilinx.
Figure 13 outlines the clocking scheme used on the ZYBO. Note that the reference clock output from the Ethernet
PHY is used as the 125 MHz reference clock to the PL, in order to cut the cost of including a dedicated oscillator for
this purpose. Keep in mind that CLK125 will be disabled when the Ethernet PHY (IC1) is held in hardware reset by
driving the PHYRSTB signal low.
Regarding your descrption:
There is one external reference clock (125 MHz) and 4 internal reference clocks from the ARM part. These 4 clocks are not accessable as a real pin but via the ARM-FPGA bridge. If I'm right this component in called PS7.
Additional resources;
- UG585 - Zynq-7000 - Technical Reference Manual chap. 25.7 PL Clocks -> schematic for PL clocks
Additionally, you can use the clock modifing blocks (MMCM or PLL) to derive new clocks from these 5 'inputs'.
So I know that for a USB port type A there is 2 ouputs/inputs. I'm working on a simple electronic circuit and I would like to ouput datas on to my computer so a program could work with it. How (without it getting too complicated on the circuit side) can I just choose the output of the USB port and read the input just on the on/off level?
Thanks
What you want is the www.Nusbio.net device.
it is an USB device that give any .NET programming languages access to 8 gpios and also SPI and I2c bus.
USB is more complicated than what you are describing. It sounds like what you really want is a serial port, where you can use the TX and RX lines as your output and input to the PC, or manually control the modem control or GPIO pins. You can still do this with USB via a USB to UART Bridge device.
If you are simply looking to toggle an I/O pin, some of these devices also have general purpose I/O pins for this type of thing. You can set it to low/high from the PC if it is set to be an output and read the I/O value if it is an input.
You can talk to it as a serial device from your computer using normal serial communications such as POSIX method for Linux or OSX or the Commuincations API for Windows. In this case you can also set the flow control to manual and use the RTS/CTS pins as GPIOs.
You cannot directly control the USB inputs and outputs like you want to do. However, there are various solutions that involve connecting a USB device to your computer and sending commands to it that use its inputs and outputs. One such solution is called Firmata.
I'm using STM32f103 micro controller for a while and today I just confused about clock source and PLL configuration!
I know the clock source is HSI by default when micro starts and startup_stm32f10x_xx.s runs, but I don't know if PLL sets or not!? how can I know whats my micro freq?
thank you
A call to RCC_GetClocksFreq() will tell you the clock frequencies (SYSCLK, HCLK, PCLK1, PCLK2, ADCCLK).
If you are using the CMSIS library for the STM32, it has functions to configure the clock and also functions to tell you at runtime what the clock is.
If you are not, you will have to look to see where the clock source is being set, and if it is the HSE you will need to know what crystal you have. Once you have that info, you can then look at the M, N, and P parameters of the PLL (if used) to calculate your HCLK. You should be able to find all this information in the reference manual for the STM32F103 in the RCC (reset and clock control) section.