Commit Graph

192 Commits

Author SHA1 Message Date
Brian Cooke
2e777d47d3
i2c: set hold time of SDA during transmit to an appropriate value (#273)
* i2c: set hold time of SDA during transmit to 2 for TCS34725 color sensor

* i2c: fix issues in i2c_write_blocking_internal

* i2c: rename sda_hold_count to sda_tx_hold_count

* use assert rather than invalid_params_if for internal consistency checks

* i2c: use a more appropriate sda tx hold time at higher baudrates

* i2c: reduce 120/1e9 to the smallest possible integer numerator and denominator

* Don't use implicit 0 for field LSB

Co-authored-by: Luke Wren <wren6991@gmail.com>
2021-04-06 10:57:25 +01:00
majbthrd
162098678b
move PLL reset code from clocks driver to pll driver (#110)
* move PLL reset code from clocks driver to pll driver

* Don't clear PLL PWR/FBDIV after reset as unnecessary. Call out in runtime.c why USB/syscfg aren't reset.

Co-authored-by: Peter Lawrence <12226419+majbthrd@users.noreply.github.com>
Co-authored-by: Luke Wren <wren6991@gmail.com>
2021-04-06 10:42:18 +01:00
Graham Sanderson
fd16563f8f
Merge pull request #299 from raspberrypi/back-merge-1.1.1
Back merge 1.1.1
2021-04-01 17:32:02 -05:00
Graham Sanderson
7f2f186bcc
build: allow board config header to specify bootstage 2 without using custom per board cmake (#293)
* build: allow compile time - and hence via board config header - choice of boot stage2 via a default compile_time_choice.S boot stage 2 which conditionally includes others
adafruit_rp2040_feather: fix flash size/clkdiv

* fixup GENERIC_03H #define names
2021-04-01 16:42:53 -05:00
Earle F. Philhower, III
3c0309c10e
Add pico_get_unique_board_id_string API (#281)
* Add pico_get_unique_board_id_string API

Add a new API to pico_unique which will turn the unique ID into a
canonical text string.

Use this API to update the USB device serial number in stdio_usb.

Supercedes #280

* Clean up -Wconversion=error issues

* Address review comments, fix api typing

Use cleaner binary-to-hex conversion.  Update the length parameter to
use uint per the SDK standard .
2021-03-30 09:04:58 -05:00
Liam Fraser
859d1d27b8
Don't advertise REMOTE_WAKEUP for USB stdio as it is is not currently implemented. Longer term need to implement REMOTE_WAKUP properly in TinyUSB. Similar fix needed in MicroPython to fix MicroPython issue #6866. The symptom is that USB serial will stop working if there is a delay of > 2 seconds ish between messages. We have seen this issue on Linux laptops with USB autosuspend enabled. (#289) 2021-03-30 09:03:28 -05:00
Andrew Scheller
85ac3d7cf8
I2C doxygen typos (#287)
* I2C doxygen typos

* another typo
2021-03-29 11:37:50 -05:00
Tom Wasiluk
c1f164b9fd
corrected clk_gpout3 to gpio pin 25 as per the rp2040 datasheet (#250) 2021-03-24 09:35:02 -05:00
Andrew Scheller
0c941d9767
Tweaks to PIO clkdiv-setting code (#254)
- refactor to reduce duplication
 - add extra param-validation
2021-03-24 09:32:38 -05:00
Mike Bell
a47d6d6e14
Allow heap end to be equal to stack limit (#266) 2021-03-24 09:26:54 -05:00
Luke Wren
98574564b8
Add gpio_get_out_level() accessor, and correct SIO GPIO_OUT struct ty… (#247)
* Add gpio_get_out_level() accessor, and correct SIO GPIO_OUT struct type from WO to RW

* Clean up ambiguous-looking parentheses
2021-03-22 12:54:33 -05:00
Jeff Epler
e9a521a9b1 rtc_get_datetime: read the rtc registers just once each
In order for the returned value to accurately reflect a single moment in time,
ensure the registers are read just once and in the datasheet order.
Before this change, the RTC registers would each be read multiple times,
leading (infrequently) to the returned fields not all reflecting the same
moment in time.

The rp2040 datasheet has what I believe is an incorrect example (embedding
the source of this function); will the datasheet be updated if this function is
fixed?

This problem is only a speculative one; I did not actually observe it in the
wild.
2021-03-22 09:11:51 -05:00
Graham Sanderson
fe3408b286
Small fixes (#260)
* pico_stdio_usb: be more explicit about includes, fix warning (#257)

* pico_base: NDEBUG backwards for absolute_time_t (#255)

* pico_util: missing extern C in queue.h (#249)

* build: remove -march which was masking -mcpu, now SVC available (#253)
2021-03-17 18:05:48 +00:00
Andrew Scheller
cdf1a956eb
Typo (#251) 2021-03-15 14:29:59 -05:00
Luke Wren
6c1150f3f4
Fix back-to-front description of IRQ priority in doxygen (#245) 2021-03-13 18:08:04 -06:00
Graham Sanderson
d36b1ca8ae
hardware_timer: fix race condition whem a new timer being added becomes missed thus obviating the need for an IRQ but there is an IRQ already pending for another timer (#243) 2021-03-10 12:04:04 -06:00
Andrew Scheller
a2576202ff Add param-validation to spin_lock_instance 2021-03-10 11:06:34 +00:00
Andrew Scheller
26fd36f853 Fixup incorrect doxygen for multicore_fifo_wready 2021-03-10 11:01:51 +00:00
Christian Flach
6f7dc67791
pio: allow programs with 32 instructions (#236) 2021-03-08 12:48:28 -06:00
Graham Sanderson
04ee63428f Remove PICO_FLASH_SIZE_BYTES warning from header as it breaks any build with -Werror; actual uses that care should warn instead (#229) 2021-03-04 21:22:48 -06:00
Andrew Scheller
4c768d2bb8 Add some extra defines to customise behaviour of STDIO_USB_RESET modes (#226)
* Add some extra defines to customise behaviour of STDIO_USB_RESET modes

* Tweaks to STDIO_USB_RESET defines
2021-03-04 21:22:48 -06:00
Andrew Scheller
dff0633c20 Add some extra defines to platform_defs.h (#227) 2021-03-04 21:22:48 -06:00
Andrew Scheller
62b2d33e8f Add PICO_DEFAULT_SPI pins to pico.h (#225)
(and define min and max values for some of the PICO_DEFAULT_* configs)
2021-03-04 21:22:48 -06:00
Andrew Scheller
1a2bb7c219 Add SPI enums to Doxygen output, fixes #213 (#216)
Also fix a few typos
2021-03-04 21:22:48 -06:00
Andrew Scheller
1413a4f470 Fixup PICO_CONFIG entries (#208)
* remove default=undefined
 * fix a couple of typos / syntax "errors"
 * perform even better default-value-checking in extract_configs.py
2021-03-04 21:22:48 -06:00
Andrew Scheller
fc17f880fd Lots of Doxygen tweaks and fixes (#212)
* Add documentation for gpio_irq_callback_t and rtc_callback_t (fixes #175)
 * Hook up pico_binary_info and pico_bootsel_via_double_reset to the Doxygen index
 * Add link to new Raspberry Pi Pico FAQ
 * Consistently add parentheses for \sa or \see links to function-names
 * Use consistent capitalisation for 'GitHub'
 * Small typos and markup errors
2021-03-04 21:22:48 -06:00
Graham Sanderson
7ee36e3328 Rationalize board header pin defines, and add partner board headers (#192)
* Board definition header files for the iniital set of SparkFun rp2040 boards

* Add default PICO_DEFAULT_I2C*, allow no PICO_DEFAULT_LED_PIN, no PICO_DEFAULT_UART* (instead of -1)
Fixup SparkFun headers

* Pimoroni board headers

* Add LED related board defines PICO_CONFIGs (to pico_stdlib for now)

* more board config changes

* add Adafruit feather, itsybitsy, qtpy board headers

* add PICO_DEFAULT_WS2812_POWER_PIN define

* MOSI/MISO -> TX/RX, some UART cleanup.. make vgaboard.h defines take preference over pico.h ones

* local change to tinyusb to cope with no default LED or UART

* fix review issues

Co-authored-by: Kirk Benell <github-stuff@accvec.com>
Co-authored-by: ZodiusInfuser <christopher.parrott2@gmail.com>
Co-authored-by: hathach <thach@tinyusb.org>
2021-03-04 21:22:48 -06:00
Andrew Scheller
e870582e48 Typo
Set correct name in PICO_CONFIG line for PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE
2021-03-04 21:22:48 -06:00
graham sanderson
383e88ea16 Add support for resetting RP2040 via the USB connection when using pico_stdio_usb
- setting baud rate to magic value (default=1200) will cause a reset to BOOTSEL mode
	- a VENDOR interface along side the CDC interface can be used to reset via refular flash boot, or into
	  BOOTSEL mode with control for the reset_usb_boot parameters for the latter
either method can be configured/enabled/disabled via #define
2021-03-04 21:22:48 -06:00
graham sanderson
61e46fefe5 Add binary info 'feature' for pico_bootsel_via_double_reset 2021-03-04 21:22:48 -06:00
graham sanderson
8ada5fa7eb hardware_rtc: make rtc_enable_alarm public 2021-03-04 21:22:48 -06:00
Graham Sanderson
4904fe2e32 remove broken and fairly pointless deep sleep API (#198)
* remove broken and fairly pointless deep sleep API, use multicore_reset_core1 instead

* strict-prototype for multicore_fifo_drain() in host header

* Also for multicore_lockout_victim_init()

Co-authored-by: Luke Wren <wren6991@gmail.com>
2021-03-04 21:22:48 -06:00
Andrew Scheller
f239bd3de5 Fixup PICO_FLASH_SIZE_BYTES PICO_CONFIG entry (no default) 2021-03-04 21:22:48 -06:00
foopub
a989f4f6ee Added ".syntax unified"
Otherwise gcc complains. I've tested this to work with the normal CMakeLists.txt provided in a few examples.
2021-03-04 21:22:48 -06:00
foopub
542b86e5db Replace unavailable flag-preserving instruction
It seems sub requires thumb2 instructions which are unavailable. This is in line with the rest of the sdk code base which uses subs.
2021-03-04 21:22:48 -06:00
graham sanderson
aca685ceae panic in debug mode if sleep methods are called in an exception handler (unless PICO_ALLOW_SLEEP_IN_EXCEPTION is set) 2021-03-04 21:22:48 -06:00
Andrew Scheller
6b2c249961 Also check enum params and doxygenise pio_mov_status_type 2021-03-04 21:22:48 -06:00
Andrew Scheller
786be7524a Extra param-checking for hardware_pio library (switch asserts to valid_params_if, and add additional checks) 2021-03-04 21:22:48 -06:00
Andrew Scheller
c1c7197757 Remove duplicate PARAM_ASSERTIONS_ENABLED_SYNC PICO_CONFIG entry 2021-03-04 21:22:48 -06:00
Graham Sanderson
743dbabdec Pico flash size bytes (#159)
* Move PICO_FLASH_SIZE_BYTES out of platform_defs.h since it precedes board config; also default to -1 for unknown

* make default for PICO_FLASH_SIZE_BYTES undefined - i.e. no value
2021-03-04 21:22:48 -06:00
graham sanderson
0d789c9b54 fix compiler warning 2021-03-04 21:22:48 -06:00
graham sanderson
3f5f5a1fd7 pio: improve (slightly) error message for claim failure on PIO 1 2021-03-04 21:22:48 -06:00
graham sanderson
d3fa64afc8 cmake: change warning message for unititialized TinyUSB 2021-03-04 21:22:48 -06:00
Graham Sanderson
e526e4f850 %g should not print 0 as infe-308 (#185) 2021-03-04 21:22:48 -06:00
Zachary Kohnen
132d6df695 Add 'hardware/structs/sio.h' header to the 'pico/multicore.h' header\n\nThe pico/multicore.h header uses the sio_hw struct, but does not include the header that defines it. This normally is not a problem since other headers include the structure as well, but since this structure is used in the header, we should not rely on other headers bringing it in and instead include it directly (#176) 2021-03-04 21:22:48 -06:00
graham sanderson
debef7471e Change _U to _u as _U exists in ctype.h 2021-03-04 21:22:48 -06:00
graham sanderson
503bc8b385 Fixup another level of compiler warnings, add _U() definition 2021-03-04 21:22:48 -06:00
graham sanderson
f16af45f9e b0 sincos shim was incorrect, causing crash 2021-03-04 21:22:48 -06:00
Graham Sanderson
b53b0bac70 Bunch of small fixes (#154)
* use valid_params_if macro for lock assertion

* fixup param checking in pwm.h

* Fix range of fractional divider parameter check in pwm.h

Co-authored-by: Luke Wren <wren6991@gmail.com>
2021-03-04 21:22:48 -06:00
Graham Sanderson
0732d0c2a3 Add more memory barriers to avoid code re-ordering issues with DMA (#155)
* Add more memory barriers to avoid code re-ordering issues with DMA

* Comment typos

* Fix Wstrict-prototype on __compiler_memory_barrier

* Remove now-redundant __compiler_barrier macro from hardware_flash

Co-authored-by: Luke Wren <wren6991@gmail.com>
2021-03-04 21:22:48 -06:00
graham sanderson
4b7ffd71f0 add boot2 info to binary info 2021-03-04 21:22:48 -06:00
Luke Wren
d492b72c29 Add pico_bootsel_via_double_reset library, fix #87 (#137)
* Add pico_bootsel_via_double_reset library, fix #87

* pico_bootsel_via_double_reset: remove unnecessary library guard, fix subdirectory ordering

* Fix C type used as PICO_CONFIG type
2021-03-04 21:22:48 -06:00
graham sanderson
dee8bd992c remove always true assertions (fix #83) 2021-03-04 21:22:48 -06:00
graham sanderson
18dbb5985c move two hardware_timer methods to the right doxygen group (fix #131) 2021-03-04 21:22:48 -06:00
graham sanderson
8b6d27d0e5 missing pico/malloc.h fixes #136 2021-03-04 21:22:48 -06:00
Graham Sanderson
6f94f6a3d7 Add -Wuninitialized -Wunused -Wcast-align to warnings checked by kitchen_sink (and fixup warnings) (#125) 2021-03-04 21:22:48 -06:00
Luke Wren
a59fd524d5 Reword some confusing terms in pio.h doxygen 2021-03-04 21:22:48 -06:00
Luke Wren
6f7c539062 oops 2021-03-04 21:22:47 -06:00
Luke Wren
24e036bde0 Fix bad range check on sideset count in pio.h 2021-03-04 21:22:47 -06:00
Luke Wren
d4c9dced40 Add missing extern "C" to header files (closes #104) 2021-03-04 21:22:47 -06:00
Luke Wren
0f4a5f8e60 Document PWM double buffering behaviour in pwm.h doxygen 2021-03-04 21:22:47 -06:00
Luke Wren
eb4023e263 pwm.h typo: int16_t -> uint16_t (closes #109) 2021-03-04 21:22:47 -06:00
Luke Wren
539270feca pio.h doxygen fixes and clarifications (closes #114) 2021-03-04 21:22:47 -06:00
Luke Wren
2a243a33e2 Fix -Wsign-compare warnings 2021-03-04 21:22:47 -06:00
Brian Swetland
a362925eda Clean up various C source and headers to appease -Wstrict-prototypes
In C, func() is a function taking an unspecified number of arguments,
vs func(void) a function taking no arguments. In C++ both forms indicate
"no arguments."

Update these headers to use the (void) form, which is correct in both
languages and avoids complaints when -Wstrict-prototypes is specified.
2021-03-04 21:22:47 -06:00
Liam Fraser
5514401bf4 Restore GPIO15 state after modifying it for USB enumeration fix (#80)
Restore GPIO15 state after usb enumeration fix
Co-authored-by: Luke Wren <wren6991@gmail.com>
2021-03-04 21:22:47 -06:00
Luke Wren
c44d5026db Add PICO_NO_FPGA_CHECK define to remove FPGA check and save some bytes 2021-03-04 21:22:47 -06:00
graham sanderson
8a4e21bd8e fixup bad static_assert 2021-02-01 14:46:45 -06:00
Luke Wren
fdcee47b70 Doxygen for uart_set_baudrate return 2021-02-01 14:46:45 -06:00
graham sanderson
a98136628c uart_set_baudrate should return actual rate set even in case of out of range parameters 2021-02-01 14:46:45 -06:00
Luke Wren
0d666eaf29 Set thumb and executable attributes on padded boot2 2021-02-01 14:46:45 -06:00
Olivier
de449d1314 Improve spi write16/read16 documentation.
The write16/read16 only work as described after changing the amount of
data_bits using spi_set_format.
2021-02-01 14:46:45 -06:00
Luke Wren
7872969915 Remove copy/pasted return from doxygen 2021-02-01 14:46:45 -06:00
graham sanderson
73ce5d2b4e fix formatting 2021-02-01 14:46:45 -06:00
Joe Komlodi
b2a44a8074 rp2_common/hardware_pio/pio: Add 'pio_add_program_at_offset' implementation
pio_add_program_at_offset() had a prototype in the header, but was
missing an implementation in the C file.
2021-02-01 14:46:45 -06:00
graham sanderson
b8c17354e4 Fix dependency on boot_stage2 so that changes actually cause update of .S and relink of main application elf 2021-02-01 14:46:45 -06:00
graham sanderson
1243ee175f flash_cs_force was ending up in flash on debug builds which is very bad! 2021-02-01 14:46:45 -06:00
graham sanderson
9ab5e8d543 fix warning/Werror in NO_FLASH build 2021-02-01 14:46:45 -06:00
Luke Wren
0e44a8013c Clarify static_assert message 2021-02-01 14:46:45 -06:00
Luke Wren
12925bc9d7 Fix doxygen group name and add to index 2021-02-01 14:46:45 -06:00
Luke Wren
82e7d02bd2 Add message to static_assert, fix formatting 2021-02-01 14:46:45 -06:00
Luke Wren
a33e620424 Add pico_unique_board_id_t struct and rename some functions/defines 2021-02-01 14:46:45 -06:00
Luke Wren
35f193386b Correct copyright header date 2021-02-01 14:46:45 -06:00
Luke Wren
c1196e9af6 Add pico_unique_id to inject ID access before main and provide accessor 2021-02-01 14:46:45 -06:00
Luke Wren
bb3cf10a09 Use correct define for FLASH_RUID_CMD 2021-02-01 14:46:45 -06:00
Luke Wren
620c75b9b8 Add flash_get_unique_id to hardware_flash 2021-02-01 14:46:45 -06:00
graham sanderson
3e52e57f5f Standardise references to the Raspberry Pi Pico SDK 2021-02-01 14:46:45 -06:00
Luke Wren
166cb0fef6 Move vector table to beginning of flash image (#10)
* Move vector table to beginning of flash image. Modify a boot2 to use the table.

* Move binary info header up between ELF entry and reset handler

* Extract common routines from boot2_w25q080 into helper files

* Non-default boot2s: use common routines, make callable as void(*)(void)

* BSD3 headers on boot2 files (people might want to use them elsewhere)

* Promote binary info header to its own section, + comment/readability changes

* Fix scope of asminclude path (fixes user custom boot2 definitions)

* Rename symbol, clarify comment
2021-02-01 14:46:45 -06:00
Graham Sanderson
419890cfd8 N_GPIOS duplicates NUM_BANK0_GPIOS (#7) 2021-02-01 14:46:45 -06:00
majbthrd
92bd96a3b2 fix #if in hardware/structs/dma.h (#9)
* fix #if in hardware/structs/dma.h

* move dma driver code from register definitions to dma drivers

Co-authored-by: Peter Lawrence <12226419+majbthrd@users.noreply.github.com>
2021-02-01 14:46:45 -06:00
Adam Boardman
9ff6b24cce Add header needed for USB flashing mode on exit when needed to avoid user having to include the header themselves. 2021-02-01 14:46:45 -06:00
graham sanderson
26653ea81e Initial Release 2021-01-20 10:44:27 -06:00