-
Notifications
You must be signed in to change notification settings - Fork 1k
Rp2350 b support #4723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rp2350 b support #4723
Changes from all commits
fe7a348
44b9620
9c6af33
c003aa0
d85f5da
dc9d586
28f938f
c6ac943
bd8e9e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,11 @@ | |
|
|
||
| package machine | ||
|
|
||
| func init() { | ||
| SysClockFrequency = Freq133MHz | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This exposes new API on machine package. Why would we want to expose a variable that can be modified by users? Is CPUFrequency() not good enough for your applications?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CPUFrequency() only gave me what the current sysClk frequency was and not the ability to overclock or under clock. There are several use cases for being able to change system frequency at runtime like peri synchronization, power management etc. This change makes changing clock speeds on the fly possible.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think changing clock frequency at runtime is in scope of this PR. If for nothing else, runtime clock support doesn't answer the question of what to do about all the code that assumes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would agree that any changes about clock frequency should be in a separate PR. |
||
| xoscFreq = Freq12MHz | ||
| } | ||
|
|
||
| // GPIO pins | ||
| const ( | ||
| GP0 Pin = GPIO0 | ||
|
|
@@ -31,9 +36,6 @@ const ( | |
| GP27 Pin = GPIO27 | ||
| GP28 Pin = GPIO28 | ||
| GP29 Pin = GPIO29 | ||
|
|
||
| // Onboard crystal oscillator frequency, in MHz. | ||
| xoscFreq = 12 // MHz | ||
| ) | ||
|
|
||
| // I2C Default pins on Raspberry Pico. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| //go:build amken_max14 | ||
|
|
||
| // This file contains the pin mappings for the Amken Max14 Intelligent Motion controller board. | ||
| // | ||
|
|
||
| package machine | ||
|
|
||
| //const ( | ||
| // // Onboard crystal oscillator frequency, in MHz. | ||
| // xoscFreq uint32 = 12 // MHz | ||
| //) | ||
|
|
||
| func init() { | ||
| SysClockFrequency = Freq240MHz | ||
| xoscFreq = Freq12MHz | ||
| } | ||
|
|
||
| // I2C Default pins on Raspberry Pico. | ||
| const ( | ||
| I2C0_SDA_PIN = NoPin | ||
| I2C0_SCL_PIN = NoPin | ||
|
|
||
| I2C1_SDA_PIN = GPIO34 | ||
| I2C1_SCL_PIN = GPIO35 | ||
|
|
||
| I2C_SDA_PIN = I2C1_SDA_PIN | ||
| I2C_SCL_PIN = I2C1_SCL_PIN | ||
| ) | ||
|
|
||
| // SPI default pins | ||
| const ( | ||
| // Default Serial Clock Bus 0 for SPI communications | ||
| SPI0_SCK_PIN = GPIO42 | ||
| // Default Serial Out Bus 0 for SPI communications | ||
| SPI0_SDO_PIN = GPIO43 // Tx | ||
| // Default Serial In Bus 0 for SPI communications | ||
| SPI0_SDI_PIN = GPIO40 // Rx | ||
|
|
||
| // Default Serial Clock Bus 1 for SPI communications | ||
| SPI1_SCK_PIN = GPIO2 | ||
| // Default Serial Out Bus 1 for SPI communications | ||
| SPI1_SDO_PIN = GPIO3 // Tx | ||
| // Default Serial In Bus 1 for SPI communications | ||
| SPI1_SDI_PIN = GPIO0 // Rx | ||
| ) | ||
|
|
||
| // UART pins | ||
| const ( | ||
| UART0_TX_PIN = GPIO0 | ||
| UART0_RX_PIN = GPIO1 | ||
| UART_TX_PIN = UART0_TX_PIN | ||
| UART_RX_PIN = UART0_RX_PIN | ||
| ) | ||
|
|
||
| var DefaultUART = UART0 | ||
|
|
||
| var StepperCS = [8]Pin{ | ||
| GPIO36, GPIO37, GPIO38, GPIO39, | ||
| GPIO20, GPIO24, GPIO27, GPIO28, | ||
| } | ||
|
|
||
| const ( | ||
| COMM_CS_PIN = GPIO1 | ||
|
|
||
| MOTOR1_CS = GPIO36 | ||
| MOTOR2_CS = GPIO37 | ||
| MOTOR3_CS = GPIO38 | ||
| MOTOR4_CS = GPIO39 | ||
| MOTOR5_CS = GPIO20 | ||
| MOTOR6_CS = GPIO24 | ||
| MOTOR7_CS = GPIO27 | ||
| MOTOR8_CS = GPIO28 | ||
|
|
||
| MOTOR1_DIR_PIN = GPIO9 | ||
| MOTOR2_DIR_PIN = GPIO13 | ||
| MOTOR3_DIR_PIN = GPIO15 | ||
| MOTOR4_DIR_PIN = GPIO17 | ||
| MOTOR5_DIR_PIN = GPIO19 | ||
| MOTOR6_DIR_PIN = GPIO23 | ||
| MOTOR7_DIR_PIN = GPIO25 | ||
| MOTOR8_DIR_PIN = GPIO30 | ||
|
|
||
| MOTOR1_STEP_PIN = GPIO10 | ||
| MOTOR2_STEP_PIN = GPIO12 | ||
| MOTOR3_STEP_PIN = GPIO14 | ||
| MOTOR4_STEP_PIN = GPIO16 | ||
| MOTOR5_STEP_PIN = GPIO18 | ||
| MOTOR6_STEP_PIN = GPIO22 | ||
| MOTOR7_STEP_PIN = GPIO26 | ||
| MOTOR8_STEP_PIN = GPIO29 | ||
| ) | ||
|
|
||
| const ( | ||
| A2D1 = ADC6 | ||
| A2D2 = ADC5 | ||
| ) | ||
|
|
||
| const ( | ||
| END_STOP_MUX1 = GPIO33 | ||
| END_STOP_MUX2 = GPIO32 | ||
| END_STOP_MUX3 = GPIO31 | ||
| ) | ||
|
|
||
| const ( | ||
| PWM_5V_1 = GPIO8 | ||
| PWM_5V_2 = GPIO11 | ||
| LOWPWR_PWM_24V_1 = GPIO21 | ||
| LOWPWR_PWM_24V_2 = GPIO47 | ||
| HIPWR_PWM_24V = GPIO7 | ||
| MEDPWR_PWM_24V = GPIO6 | ||
| ) | ||
|
|
||
| const ( | ||
| NEOPIXEL_1 = GPIO41 | ||
| NEOPIXEL_2 = GPIO44 | ||
| ) | ||
|
|
||
| // USB identifiers | ||
| const ( | ||
| usb_STRING_PRODUCT = "Max14 Intelligent Motion Controller" | ||
| usb_STRING_MANUFACTURER = "AmkenLLC" | ||
| ) | ||
|
|
||
| var ( | ||
| usb_VID uint16 = 0x2E8A | ||
| usb_PID uint16 = 0x7303 | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid init functions in machine package always unless absolutely required. I'd like to understand the problem you are trying to solve so I can propose a better way of doing this.